Commit 65aaf969 authored by 夏彬's avatar 夏彬

Merge branch 'master' of git.banshouhui.com:yangpp/wxh_internal_api

parents 368a5740 1113bdba
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/10/19
* Time: 11:50
*/
use internalApi\bbs\Credit;
use internalApi\bbs\Task;
require __DIR__.'/_init.php';
//Credit::setDebug(true);
Task::setDebug(true);
//$kk = Credit::updateExp(12, 1, '', 0, '测试加分RuleText', '测试加分Title', '测试加分Memo');
//$kk = Credit::updateCoin(12, 1, '', 0, '测试加分RuleText', '测试加分Title', '测试加分Memo');
//$kk = Credit::updateExp(12, 1, 'watch_video', 15, '测试加分RuleText', '测试加分Title', '看视频');
//Credit::updateCreditByAction('reply', 12);
$ret = Credit::updateCoin(12, 10, '', 0, '', '抽奖奖励扳手币', '抽奖奖励扳手币');
var_dump($ret);
//$ret = Task::trigger('wxh_medal_task:share', 12);
//var_dump($ret);
\ No newline at end of file
...@@ -14,8 +14,11 @@ Member::setDebug(); ...@@ -14,8 +14,11 @@ Member::setDebug();
//Member::updateNickname(12, 'Test Hello World'); //Member::updateNickname(12, 'Test Hello World');
$bin = file_get_contents('/Users/pader/Development/sites/wxh/ucenter/src/resource/tmp/zxx.jpg'); //$bin = file_get_contents('/Users/pader/Development/sites/wxh/ucenter/src/resource/tmp/zxx.jpg');
Member::updateAvatar(12, 'jpg', base64_encode($bin)); //Member::updateAvatar(12, 'jpg', base64_encode($bin));
$ret = Member::getWechatInfoFromCode('dasfasdfsdaf');
var_dump($ret);
//$info = Member::getMemberInfo(12); //$info = Member::getMemberInfo(12);
// $info = Member::getInfoByMobile('15395081586'); // $info = Member::getInfoByMobile('15395081586');
......
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/10/19
* Time: 09:35
*/
namespace internalApi\bbs;
use internalApi\base\Client;
class Credit extends Client
{
/**
* 更新扳手币
*
* @param int $ucid 用户中心UID
* @param int $paycredits 扳手币更新数量,正数为加,负数为减
* @param string $operation 操作标识,三位字符串,请在论坛中进行定义,否则保留为空
* @param int $relatedid 对应操作标识的ID
* @param string $ruletxt 提醒文字,默认为空即可
* @param string $customtitle 记录标题
* @param string $custommemo 记录备注
* @return bool 返回 false 代表更新失败,否则视为成功
* @throws \internalApi\base\ApiException|\internalApi\base\ClientException
*/
public static function updateCoin($ucid, $paycredits, $operation = '', $relatedid = 0, $ruletxt = '', $customtitle = '', $custommemo = '')
{
return self::call('credit.updateCoin', compact('ucid', 'paycredits', 'operation', 'relatedid', 'ruletxt', 'customtitle', 'custommemo'));
}
/**
* 更新扳手值
*
* @param int $ucid 用户中心UID
* @param int $paycredits 扳手值更新数量,正数为加,负数为减
* @param string $operation 操作标识,三位字符串,请在论坛中进行定义,否则保留为空
* @param int $relatedid 对应操作标识的ID
* @param string $ruletxt 提醒文字,默认为空即可
* @param string $customtitle 记录标题
* @param string $custommemo 记录备注
* @return bool 返回 false 代表更新失败,否则视为成功
* @throws \internalApi\base\ApiException|\internalApi\base\ClientException
*/
public static function updateExp($ucid, $paycredits, $operation = '', $relatedid = 0, $ruletxt = '', $customtitle = '', $custommemo = '')
{
return self::call('credit.updateExp', compact('ucid', 'paycredits', 'operation', 'relatedid', 'ruletxt', 'customtitle', 'custommemo'));
}
/**
* 执行积分策略
*
* @param string $action 策略标识
* @param int $uid 执行策略的用户
* @return bool
* @throws \internalApi\base\ApiException|\internalApi\base\ClientException
*/
public static function updateCreditByAction($action, $uid)
{
return self::call('credit.updateCreditByAction', ['action'=>$action, 'ucid'=>$uid]);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/10/25
* Time: 18:39
*/
namespace internalApi\bbs;
use internalApi\base\Client;
class Task extends Client
{
/**
* 触发及检查任务完成状态
*
* @param string $scriptName 任务脚本名称
* @param int $uid
* @param bool $autoApply 未申请的任务是否自动申请
* @return bool
* @throws \internalApi\base\ApiException|\internalApi\base\ClientException
*/
public static function trigger($scriptName, $uid, $autoApply=false)
{
return self::call('task.trigger', [
'scriptname' => $scriptName,
'ucid' => $uid,
'autoapply' => $autoApply
]);
}
}
\ No newline at end of file
...@@ -30,6 +30,7 @@ class User extends Client ...@@ -30,6 +30,7 @@ class User extends Client
* 获取金币 * 获取金币
* @param $uid * @param $uid
* @return mixed * @return mixed
* @deprecated 成长体系上线后统一使用新接口
*/ */
public static function getGoldCoin($uid) public static function getGoldCoin($uid)
{ {
...@@ -42,11 +43,25 @@ class User extends Client ...@@ -42,11 +43,25 @@ class User extends Client
* @param string $title 记录标题 例如 完工奖励 * @param string $title 记录标题 例如 完工奖励
* @param string $text 记录内容 例如 完成工单奖励金钱+<span>5<span> * @param string $text 记录内容 例如 完成工单奖励金钱+<span>5<span>
* @return mixed * @return mixed
* @deprecated 成长体系上线后统一使用新接口
*/ */
public static function updateGoldCoin($telephone,$num,$title,$text){ public static function updateGoldCoin($telephone,$num,$title,$text){
return self::call('user.updateGoldCoin', compact('telephone','num','title','text')); return self::call('user.updateGoldCoin', compact('telephone','num','title','text'));
} }
/**
* 根据用户UID更新金币
* @param int $uid 用户UID
* @param int $num 加减的数量 +-num
* @param string $title 记录标题 例如 完工奖励
* @param string $text 记录内容 例如 完成工单奖励金钱+<span>5<span>
* @return void
* @deprecated 成长体系上线后统一使用新接口
*/
public static function updateGoldCoinByUid($uid,$num,$title,$text){
return self::call('user.updateGoldCoinByUid', compact('uid','num','title','text'));
}
/** /**
* 获取签到的日期 * 获取签到的日期
* @param int $userId * @param int $userId
...@@ -70,4 +85,19 @@ class User extends Client ...@@ -70,4 +85,19 @@ class User extends Client
return self::call('user.getMemberCount', compact('uid')); return self::call('user.getMemberCount', compact('uid'));
} }
/**
* 不活跃用户业务处理
*
* 连续N天不登录,减少扳手值
*
* @param array $uIds 用户中心id集合, 如: [27,38,79]
* @return mixed
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public static function inactive($uIds)
{
return self::call('user.inactive', compact('uIds'));
}
} }
\ No newline at end of file
...@@ -30,4 +30,16 @@ class User extends Client ...@@ -30,4 +30,16 @@ class User extends Client
return self::call('user.updateSync', compact('uid', 'data')); return self::call('user.updateSync', compact('uid', 'data'));
} }
/**
* 获取我的验证码数量
* @param $uid
* @return mixed
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public static function getMyCodeNum($uid)
{
return self::call('user.getMyCodeNum', compact('uid'));
}
} }
\ No newline at end of file
<?php
namespace internalApi\ucenter;
use internalApi\base\Client;
/**
* Class DrawActivity
*
* @package internalApi\ucenter
*/
class DrawActivity extends Client
{
/**
* 获取当前正在进行的抽奖活动详情
*
* @throws \internalApi\base\ApiException
*/
public static function getCurrentActivity()
{
return self::call('drawActivity.getCurrentActivity');
}
}
\ No newline at end of file
...@@ -105,4 +105,42 @@ class Member extends Client ...@@ -105,4 +105,42 @@ class Member extends Client
self::call('member.updateAvatar', compact('uid', 'format', 'avatarBase64')); self::call('member.updateAvatar', compact('uid', 'format', 'avatarBase64'));
} }
/**
* 通过微信授权返回的内部信息码获取用户信息
*
* @param string $code
* @return array|false
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public static function getWechatInfoFromCode($code)
{
return self::call('member.getWechatInfoFromCode', compact('code'));
}
/**
* 获取用户扩展信息
* @param $uid
* @return mixed
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public static function getExt($uid)
{
return self::call('member.getExt', compact('uid'));
}
/**
* 更新用户扩展选项
* @param $uid
* @param string $option 选项 {share: '分享', comment: '评论', error_code: '故障码', course: '课程', worker_diary: '维修日记', like: '点赞', post: '帖子'}
* @param bool $trigger 是否触发积分策略和任务机制
* @return mixed
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public static function updateExtOption($uid, $option, $trigger=true)
{
return self::call('member.updateExtOption', compact('uid', 'option', 'trigger'));
}
} }
\ No newline at end of file
...@@ -15,4 +15,5 @@ class MemberRedpack extends Client ...@@ -15,4 +15,5 @@ class MemberRedpack extends Client
{ {
return self::call('memberRedpack.firstRedpack',compact('userId')); return self::call('memberRedpack.firstRedpack',compact('userId'));
} }
} }
\ No newline at end of file
...@@ -91,11 +91,10 @@ class Message extends Client ...@@ -91,11 +91,10 @@ class Message extends Client
* @param string $replyedComment * @param string $replyedComment
* @param string $extra * @param string $extra
* @return mixed * @return mixed
* @deprecated
*/ */
public static function addComment($userId, $title, $sourceUrl, $from, $type, $commentId, $replyUserId, $replyedComment = '', $extra = '') public static function addComment($userId, $title, $sourceUrl, $from, $type, $commentId, $replyUserId, $replyedComment = '', $extra = '')
{ {}
return self::call('message.addComment', compact('userId', 'title', 'sourceUrl', 'from', 'type', 'commentId', 'replyUserId', 'replyedComment', 'extra'));
}
/** /**
* @param $userId * @param $userId
...@@ -107,11 +106,10 @@ class Message extends Client ...@@ -107,11 +106,10 @@ class Message extends Client
* @param $likeUserId * @param $likeUserId
* @param $likedComment * @param $likedComment
* @return mixed * @return mixed
* @deprecated
*/ */
public static function addLike($userId, $title, $sourceUrl, $from, $type, $sourceId, $likeUserId, $likedComment = '') public static function addLike($userId, $title, $sourceUrl, $from, $type, $sourceId, $likeUserId, $likedComment = '')
{ {}
return self::call('message.addLike', compact('userId', 'title', 'sourceUrl', 'from', 'type', 'sourceId', 'likeUserId', 'likedComment'));
}
/** /**
* @param $userId * @param $userId
...@@ -122,11 +120,10 @@ class Message extends Client ...@@ -122,11 +120,10 @@ class Message extends Client
* @param string $content * @param string $content
* @param int $toUser 0系统消息其它为用户id,多个用户id数组 * @param int $toUser 0系统消息其它为用户id,多个用户id数组
* @return mixed * @return mixed
* @deprecated
*/ */
public static function add($userId, $title, $desc, $from, $type, $content = '', $toUser = 0) public static function add($userId, $title, $desc, $from, $type, $content = '', $toUser = 0)
{ {}
return self::call('message.add', compact('userId', 'title', 'desc', 'from', 'type', 'content', 'toUser'));
}
/** /**
* 删除评论消息 * 删除评论消息
...@@ -135,11 +132,10 @@ class Message extends Client ...@@ -135,11 +132,10 @@ class Message extends Client
* @param $type * @param $type
* @param $commentId * @param $commentId
* @return mixed * @return mixed
* @deprecated
*/ */
public static function deleteComment($userId, $from, $type, $commentId) public static function deleteComment($userId, $from, $type, $commentId)
{ {}
return self::call('message.deleteComment', compact('userId', 'from', 'type', 'commentId'));
}
/** /**
* 删除点赞 * 删除点赞
...@@ -148,11 +144,10 @@ class Message extends Client ...@@ -148,11 +144,10 @@ class Message extends Client
* @param $type * @param $type
* @param $sourceId * @param $sourceId
* @return mixed * @return mixed
* @deprecated
*/ */
public static function deleteLiked($userId, $from, $type, $sourceId) public static function deleteLiked($userId, $from, $type, $sourceId)
{ {}
return self::call('message.deleteLiked', compact('userId', 'from', 'type', 'sourceId'));
}
/** /**
* @param $title 消息标题 * @param $title 消息标题
...@@ -162,11 +157,10 @@ class Message extends Client ...@@ -162,11 +157,10 @@ class Message extends Client
* @param string $from 来自 * @param string $from 来自
* @param int $type 0 早报 1 求助 2 系统推送 * @param int $type 0 早报 1 求助 2 系统推送
* @return mixed * @return mixed
* @deprecated
*/ */
public static function pushMsg($title, $url, $desc, $userId = 0, $from = 'u', $type = 0) public static function pushMsg($title, $url, $desc, $userId = 0, $from = 'u', $type = 0)
{ {}
return self::call('message.pushMsg', compact('title', 'url', 'desc', 'userId','from','type'));
}
/** /**
* 以系统会话发送消息 * 以系统会话发送消息
......
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/12/11
* Time: 11:43
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
/**
* 通用用户提示服务
* @package internalApi\ucenter
*/
class Notice extends Client
{
/**
* 添加积分提示
*
* @param int $uid
* @param string $action 动作文字,如“发表帖子”
* @param array $credits 变化积分数字,以积分序号对应数字的形式
*/
public static function addCredit($uid, $action, $credits)
{
self::call('notice.addCredit', compact('uid', 'action', 'credits'));
}
/**
* 添加勋章提示
*
* @param int $uid
* @param string $icon
* @param string $name
* @param string $description
* @param $url
*/
public static function addMedal($uid, $icon, $name, $description, $url)
{
self::call('notice.addMedal', compact('uid', 'icon', 'name', 'description', 'url'));
}
/**
* 添加Toast提示
*
* @param int $uid
* @param string $text
* @param null|int $timeout 提示留存时间,毫秒单位,默认为 1500
*/
public static function addToast($uid, $text, $timeout=null)
{
self::call('notice.addToast', compact('uid', 'text', 'timeout'));
}
}
\ No newline at end of file
...@@ -94,4 +94,28 @@ class Order extends Client ...@@ -94,4 +94,28 @@ class Order extends Client
return self::call('order.verifyNotifyCode', compact('oid', 'code')); return self::call('order.verifyNotifyCode', compact('oid', 'code'));
} }
/**
* 获取用户的消费金额
* @param $uid
* @return mixed
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public static function getMonetary($uid)
{
return self::call('order.getMonetary', compact('uid'));
}
/**
* 获取用户购买课程的数量
* @param $uid
* @return mixed
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public static function getBuyCourseTotal($uid)
{
return self::call('order.getBuyCourseTotal', compact('uid'));
}
} }
\ No newline at end of file
<?php
namespace internalApi\ucenter;
use internalApi\base\Client;
/**
* Class Prize
*
* @package internalApi\ucenter
*/
class Prize extends Client
{
/**
* 根据id获取奖品数据
*
* @param array $ids 奖品id数组
* @return array 奖品信息
* @throws \internalApi\base\ApiException
*/
public static function getPrizeListByIds($ids)
{
return self::call('prize.getPrizeListByIds', compact('ids'));
}
/**
* 获取中奖记录
* @param integer $uid 用户id
* @param integer $prizeId 奖品id
*
* @return array|null|\yii\db\ActiveRecord
*/
public static function getPrizeRaffleByUid($uid,$prizeId)
{
return self::call('prize.getPrizeRaffleByUid', compact('uid','prizeId'));
}
/**
* 添加中奖记录
*
* @param $uid 用户id
* @param $prizeId 奖品id
*
* @return bool
* @throws \Exception
*/
public static function createPrizeRaffle($uid, $prizeId)
{
return self::call('prize.createPrizeRaffle', compact('uid','prizeId'));
}
/**
* 根据用户id和奖品id获取当月中奖记录详情
*
* @param integer $uid
* @param integer $prizeId
*
* @return array|null|\yii\db\ActiveRecord
*/
public static function getMonthPrizeRaffleByUid($uid, $prizeId)
{
return self::call('prize.getMonthPrizeRaffleByUid', compact('uid','prizeId'));
}
/**
* 根据用户id获取中奖记录列表
*
* @param integer $uid
*
* @return array|null|\yii\db\ActiveRecord
*/
public static function getPrizeRaffleListByUid($uid)
{
return self::call('prize.getPrizeRaffleListByUid', compact('uid'));
}
}
\ No newline at end of file
...@@ -38,4 +38,5 @@ class Timeline extends Client ...@@ -38,4 +38,5 @@ class Timeline extends Client
{ {
return self::call('Timeline.removeTimeline', compact('key')); return self::call('Timeline.removeTimeline', compact('key'));
} }
} }
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/12/12
* Time: 11:50
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
/**
* 师傅数据服务
* @package internalApi\ucenter
*/
class Worker extends Client
{
/**
* 获取指定师傅的完成工单数量
* @param string $uid 用户中心ID
* @return int
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public static function queryOrderDoneCount($uid)
{
return self::call('worker.queryOrderDoneCount', compact('uid'));
}
}
\ No newline at end of file
...@@ -67,4 +67,18 @@ class Course extends Client ...@@ -67,4 +67,18 @@ class Course extends Client
return self::call('course.getCourseDetails', compact('courseIds')); return self::call('course.getCourseDetails', compact('courseIds'));
} }
/**
* 生成订单记录
*
* @param int $userId 用户id
* @param int $courseId 课程id
* @param string $orderId 订单id
*
* @return bool
*/
public static function sendCourse($userId, $courseId, $orderId){
return self::call('course.sendCourse', compact('userId','courseId','orderId'));
}
} }
\ No newline at end of file
...@@ -41,4 +41,16 @@ class User extends Client ...@@ -41,4 +41,16 @@ class User extends Client
return self::call('user.updateSync', compact('uid', 'data')); return self::call('user.updateSync', compact('uid', 'data'));
} }
/**
* 获取用户扩展信息
* @param $uid
* @return mixed
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public static function getExt($uid)
{
return self::call('user.getExt', compact('uid'));
}
} }
\ No newline at end of file
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