123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <?php
- /**
- * UserController.php UTF-8
- *
- *
- * @date : 2018/6/11 16:36
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : luowei <lw@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace api\wapapp\controller\v8;
- use api\common\controller\V2ApiBaseController;
- use huo\controller\integral\MemIntegral;
- use huo\controller\member\Bind;
- use huo\controller\member\Member;
- use huo\controller\sign\Sign;
- use huoIdentify\controller\Identify;
- use huolib\constant\MemConst;
- use huolib\status\CommonStatus;
- use huolib\status\MemberStatus;
- use think\Lang;
- class UserController extends V2ApiBaseController {
- public function _initialize() {
- parent::_initialize();
- $langSet = $this->request->langset();
- Lang::load([APP_PATH.'wapapp'.DS.'lang'.DS.$langSet.DS.'user'.EXT,]);
- $this->checkLogin();
- }
- /**
- * 获取用户信息
- * http://doc.1tsdk.com/138?page_id=3131
- * 【域名】/user/detail
- */
- public function detail() {
- $_app_id = get_val($this->rq_data, 'app_id');
- $_rdata = (new Member())->getMemInfo($this->mem_id, $_app_id);
- if (isset($_rdata['status']) && $_rdata['status'] == MemConst::STATUS_FORBID) {
- $_code = MemberStatus::LOGIN_IS_OUT;
- $this->error(lang(MemberStatus::getMsg($_code)), [], $_code);
- }
- /* Modified by chenbingling BEGIN 2019/11/29 ISSUES:10837 实名认证新规调整 */
- $_game_rq = $this->setGameData();
- $_device_rq = $this->setDeviceData();
- $_auth_info = (new Identify())->getMemIdentifyInfo(
- $_game_rq->getHAppId(), $this->mem_id, $_device_rq->getDeviceId(), $this->token
- );
- $_rdata['url'] = get_val($_auth_info, 'url', '');
- $_rdata['auth_info'] = get_val($_auth_info, 'auth_info', null);
- $siteInfo = cmf_get_site_info();
- $_rdata['wap_app_down_url'] = get_val($siteInfo, 'wap_app_down_url', '');
- /* END 2019/11/29 ISSUES:10837 */
- $_code = MemberStatus::NO_ERROR;
- $this->success(MemberStatus::getMsg($_code), $_rdata);
- }
- /**
- * 修改昵称
- * http://doc.1tsdk.com/138?page_id=3367
- * 【域名】/user/nickname/update
- */
- public function updateNickname() {
- $_data = $this->request->param();
- $result = $this->validate($_data, [
- 'nickname' => 'require|chsDash|max:32',
- ],[
- 'nickname.require' => lang('nickname is null'),
- 'nickname.chsDash' => lang('nickname Invalid'),
- 'nickname.max' => lang('nickname Up to 32 characters'),
- ]);
- if (true !== $result) {
- $this->error($result, [], CommonStatus::INVALID_PARAMS);
- }
- $_nickname = get_val($_data, 'nickname');
- $_rs = (new Member())->updateNickname($this->mem_id, $_nickname);
- if (MemberStatus::NO_ERROR != $_rs['code']) {
- $this->error($_rs['msg'], $_rs['data'], $_rs['code']);
- }
- $this->success($_rs['msg'], $_rs['data'], $_rs['code']);
- }
- /**
- * 修改密码
- * http://doc.1tsdk.com/138?page_id=3372
- * 【域名】/user/passwd/update
- */
- public function updatePwd() {
- $_data = $this->request->param();
- $result = $this->validate($_data, [
- 'oldpwd' => 'require',
- 'newpwd' => 'require|length:6,32',
- ],[
- 'oldpwd.require' => lang('oldpwd is null'),
- 'newpwd.require' => lang('newpwd is null'),
- 'newpwd.length' => lang('newpwd length is 6~32 characters'),
- ]);
- if (true !== $result) {
- $this->error($result, [], CommonStatus::INVALID_PARAMS);
- }
- $_oldpwd = get_val($_data, 'oldpwd');
- $_newpwd = get_val($_data, 'newpwd');
- $_mem_class = new Member();
- $_rs = $_mem_class->updatePwd($this->mem_id, $_oldpwd, $_newpwd);
- if (MemberStatus::NO_ERROR != $_rs['code']) {
- $this->error($_rs['msg'], $_rs['data'], $_rs['code']);
- }
- $this->success($_rs['msg'], $_rs['data'], $_rs['code']);
- }
- /**
- * 签到
- * http://doc.1tsdk.com/138?page_id=3147
- * 【域名】/v8/user/signin
- */
- public function signin() {
- $_sign_class = new Sign();
- $_rs = $_sign_class->sign($this->getMemId());
- if (MemberStatus::NO_ERROR != $_rs['code']) {
- $this->error($_rs['msg'], $_rs['data'], $_rs['code']);
- }
- $this->success($_rs['msg'], $_rs['data'], $_rs['code']);
- }
- /**
- * 积分记录列表
- * http://doc.1tsdk.com/138?page_id=3119
- * 【域名】/v8/score/record/list
- */
- public function scoreList() {
- $_mem_id = $this->getMemId();
- $_page = $this->request->param('page/d', 1);
- $_offset = $this->request->param('offset/d', 10);
- $_itg_type = $this->request->param('itg_type/d', 1);/* 记录类型:1 获得 2 消费 */
- $_page = $_page.','.$_offset;
- $_ml_class = new MemIntegral();
- $where['itg_type'] = $_itg_type;
- $_rdata = $_ml_class->getItgList($where, $_page, $_mem_id);
- $this->success($_rdata['msg'], $_rdata['data'], $_rdata['code']);
- }
- /**
- * 用户密保信息
- * http://doc.1tsdk.com/138?page_id=3398
- * 【域名】/user/bind/info
- */
- public function bindInfo() {
- $_mem_id = $this->getMemId();
- $_rdata = (new Bind())->getBindInfo($_mem_id);
- return $this->returnData($_rdata);
- }
- }
|