Commit de0848ed authored by 夏彬's avatar 夏彬

Merge remote-tracking branch 'origin/test' into test

parents c624d91c 0ffc64cc
This diff is collapsed.
<?php
use internalApi\ucenter\Credit;
require(__DIR__ . '/../extend/internalApi/autoload.php');
require(__DIR__ . "/../class/connect.php");
require(__DIR__ . "/../class/db_sql.php");
require(__DIR__ . "/../member/class/user.php");
require(__DIR__ . "/../class/q_functions.php");
require __DIR__.'/../config/config_ibanshou.php';
\internalApi\base\Client::config($config['wxh.internal']['client']);
$link=db_connect();
$empire=new mysqlquery();
$mod = isset($_GET['mod']) ? $_GET['mod']: '';
$type = isset($_GET['type'])?$_GET['type']:'';
$user = islogin();
$typeMap = [
'share' => 1,
];
if($mod == 'credit'){
$userId = $user['ucid'];
if (isset($typeMap[$type])) {
$creditRuleId = $typeMap[$type];
} else {
echo json_encode(['status'=>false,'message'=>'type 字段错误']);
}
$creditRule = Credit::addCreditLog($userId, $creditRuleId);
if ($creditRule) {
$creditInfo = array('title'=>$creditRule['operation_name'],'desc'=>$creditRule['operation_details'],'number'=>$creditRule['number']);
setcookie('creditNotice',json_encode($creditInfo),0,'/');
echo json_encode(['status'=>true,'message'=>'ok','creditRule'=>$creditRule]);
} else {
echo json_encode(['status'=>false]);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/8/23
* Time: 11:28
*/
namespace internalApi\bbs;
use internalApi\base\Client;
class User extends Client
{
/**
* 同步更新用户基本信息
*
* @param int $uid
* @param array $data
* @return bool
*/
public static function updateSync($uid, $data)
{
return self::call('user.updateSync', compact('uid', 'data'));
}
/**
* 获取金币
* @param $uid
* @return mixed
*/
public static function getGoldCoin($uid)
{
return self::call('user.getGoldCoin', compact('uid'));
}
/**
* @param string $telephone 手机号
* @param int $num 加减的数量 +-num
* @param string $title 记录标题 例如 完工奖励
* @param string $text 记录内容 例如 完成工单奖励金钱+<span>5<span>
* @return mixed
*/
public static function updateGoldCoin($telephone,$num,$title,$text){
return self::call('user.updateGoldCoin', compact('telephone','num','title','text'));
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: QQ
* Date: 2018/4/8
* Time: 9:56
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
class Credit extends Client
{
/**
* 添加积分
* @param $userId
* @param $creditRuleId
* @return mixed
*/
public static function addCreditLog($userId,$creditRuleId)
{
return self::call('credit.addCreditLog',compact('userId','creditRuleId'));
}
}
\ No newline at end of file
......@@ -51,21 +51,21 @@ function comments() {
function tpl(comment) {
var html = '<li data-id="'+ comment.id +'">\
var html = '<li data-id="' + comment.id + '">\
<img src="' + comment.avatar + '">\
<div class="name">' + comment.nickname + '</div>\
<div class="comment-main">' + comment.content + '</div>\
<div class="comment-footbar clearfix">\
<span>' + comment.created_at + '</span>\
<a href="javascript:popReplyComment(' + comment.id + ');" class="pl-reply"><i class="iconfont icon-comment_light"></i>回复</a> \
<a href="javascript:likeComment(' + comment.id + ', ' + comment.islike + ');" class="pl-zan"><i class="iconfont '+(comment.islike?"icon-zan-fill":"icon-zan")+'"></i>赞</a> \
<a href="javascript:likeComment(' + comment.id + ', ' + comment.islike + ');" class="pl-zan"><i class="iconfont ' + (comment.islike ? "icon-zan-fill" : "icon-zan") + '"></i>赞</a> \
</div>';
if (!$.isEmptyObject(comment.reply)) {
var replys = comment.reply;
html += '<div class="comment-replay">';
for (i in replys) {
html += '<div class="comment-replay-list"><span>'+replys[i].nickname+':</span>'+replys[i].content+' <span>'+replys[i].created_at+'</span></div>';
html += '<div class="comment-replay-list"><span>' + replys[i].nickname + ':</span>' + replys[i].content + ' <span>' + replys[i].created_at + '</span></div>';
}
html += '</div>';
}
......@@ -74,7 +74,7 @@ function tpl(comment) {
//回复弹窗
function popReplyComment(id) {
var parent = $('.comment-list').find('> li[data-id='+id+']');
var parent = $('.comment-list').find('> li[data-id=' + id + ']');
var name = parent.find('> .name').text() + ':';
var content = parent.find('> .comment-main').text();
$('#reply-name').text(name);
......@@ -119,15 +119,15 @@ $(".reply-pl").click(function () {
});
function handelReplyComment(plid, comment) {
$.each( $('.comment-list li'), function(){
$.each($('.comment-list li'), function () {
if ($(this).attr('data-id') == plid) {
var html = '';
if($(this).children(".comment-replay").html()) {
html = '<div class="comment-replay-list"><span>'+comment.nickname+':</span>'+comment.content+' <span>'+comment.created_at+'</span></div>';
if ($(this).children(".comment-replay").html()) {
html = '<div class="comment-replay-list"><span>' + comment.nickname + ':</span>' + comment.content + ' <span>' + comment.created_at + '</span></div>';
$(this).children(".comment-replay").append(html);
} else {
html = '<div class="comment-replay">\
<div class="comment-replay-list"><span>'+comment.nickname+':</span>'+comment.content+' <span>'+comment.created_at+'</span></div>\
<div class="comment-replay-list"><span>' + comment.nickname + ':</span>' + comment.content + ' <span>' + comment.created_at + '</span></div>\
</div>';
$(this).append(html);
}
......@@ -143,7 +143,7 @@ function likeComment(plid, islike) {
$.post("/e/action/news/comment.php?mod=like", {plid: plid}, function (e) {
if (e.status) {
$.each( $('.comment-list li'), function(){
$.each($('.comment-list li'), function () {
if ($(this).attr('data-id') == plid) {
$(this).find(".icon-zan").addClass("icon-zan-fill").removeClass("icon-zan");
}
......@@ -154,6 +154,55 @@ function likeComment(plid, islike) {
}, 'json');
}
function shareSuccessCallback(type) {
$.ajax({
type: "GET",
url: "/e/action/credit.php?mod=credit&type=" + type,
data: '',
dataType: "json",
success: function (response) {
if (response.status) {
cookieTips();
}
}
});
}
function getCookie(sName) {
var aCookie = document.cookie.split("; ");
for (var i = 0; i < aCookie.length; i++) {
var aCrumb = aCookie[i].split("=");
if (sName == aCrumb[0])
return unescape(aCrumb[1]);
}
return null;
}
function setCookie(cname, cvalue) {
document.cookie = cname + "=" + cvalue + "; ";
}
function deleteCookie(name, path) { // 删除Cookie
var strCookie;
// 检查Cookie是否存在
// 设置Cookie的期限为己过期
strCookie = name + "=";
strCookie += (path) ? "; path=" + path : "";
document.cookie = strCookie;
}//end function deleteCookie
function cookieTips() {
var obj = getCookie('creditNotice');
if (obj) {
obj = JSON.parse(obj);
var desc = '金币 +' + obj.number;
Banshou.creditTip(obj.title, desc, 3000);
deleteCookie('creditNotice','/');
}
}
function pop(msg, islogin) {
if (islogin === 'nologin') {
location.href = "/e/member/login";
......@@ -178,7 +227,7 @@ function scrollLoading() {
var lastplid = $(".comment-list li:last-child").attr('data-id');
lastplid = lastplid ? lastplid : 0;
scrollLoad.html("<img src='" + spinner + "'>");
$.post("/e/action/news/comment.php", {newsid:newsid, lastplid:lastplid}, function (e) {
$.post("/e/action/news/comment.php", {newsid: newsid, lastplid: lastplid}, function (e) {
if (!$.isEmptyObject(e.data)) {
var comments = e.data;
var html = '';
......@@ -189,7 +238,7 @@ function scrollLoading() {
} else {
scrollLoad.html("全部加载完毕");
$(window).off("scroll", scrollLoading);
setTimeout(function() {
setTimeout(function () {
scrollLoad.slideUp();
}, 1000);
}
......@@ -224,11 +273,11 @@ $.post("/e/action/news/index.php?mod=init", {newsid: newsid}, function (e) {
//点赞
function diggtop() {
$('#zan').one('click',function () {
$('#zan').one('click', function () {
$.post("/e/action/news/index.php?mod=diggtop", {newsid: newsid}, function (e) {
if (e.status) {
$("#zan").find('i').removeClass('icon-zan').addClass('icon-zan-fill');
$('.zan-tip').animate({opacity: "1", top: "-=30"},500).animate({opacity: "0", top: "-30"}, "slow");
$('.zan-tip').animate({opacity: "1", top: "-=30"}, 500).animate({opacity: "0", top: "-30"}, "slow");
} else {
pop(e.msg, e.data);
}
......@@ -253,9 +302,9 @@ $('#favor').click(function () {
}, 'json');
});
(function($) {
(function ($) {
//加载乐视视频
$("div.lecloud-video").each(function() {
$("div.lecloud-video").each(function () {
var width = 640, height = 360, rate = width / height;
var video = createVideoElement(width, height);
$(this).replaceWith(video);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment