123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- /**
- * Identify.php UTF-8
- *
- *
- * @date : 2018/4/27 16:48
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace huo\controller\member;
- use huo\controller\common\Base;
- use huo\controller\integral\MemIa;
- use huolib\constant\IaConst;
- use huolib\status\IdentifyStatus;
- use huolib\status\MemberStatus;
- use huolib\utils\IdentifyUtils;
- class Identify extends Base {
- /**
- * @param $mem_id
- * @param int $type
- * @param $real_name
- * @param $id_card
- *
- * @return mixed
- */
- public function update($mem_id, $type = 1, $real_name, $id_card) {
- $_mem_data = MemCache::ins()->getInfoById($mem_id);
- if (empty($_mem_data)) {
- return $this->huoSuccess(MemberStatus::LOGIN_IS_OUT, MemberStatus::getMsg(MemberStatus::LOGIN_IS_OUT));
- }
- $_chk_rs = IdentifyUtils::checkIdentify($type, $real_name, $id_card);
- if (IdentifyStatus::NO_ERROR != $_chk_rs) {
- return $this->retErrMsg($_chk_rs);
- }
- $_old_id_card = $_mem_data['id_card'];
- $_mem_data['real_name'] = $real_name;
- $_mem_data['id_card'] = $id_card;
- $_mem_data['identify_type'] = $type;
- $_rs = MemCache::ins()->updateMem($mem_id, $_mem_data);
- if (false == $_rs) {
- return $this->huoSuccess(MemberStatus::INNER_ERROR, MemberStatus::getMsg(MemberStatus::INNER_ERROR));
- }
- /* 实名认证成功获取积分 */
- if (empty($_old_id_card)) {
- (new MemIa($mem_id))->doItgAct(IaConst::IA_IDENTIFY);
- }
- return $this->retSucMsg(IdentifyStatus::NO_ERROR);
- }
- /**
- * @param int $code
- * @param array $data
- *
- * @return array
- */
- protected function retSucMsg($code, $data = []) {
- $_msg = IdentifyStatus::getMsg($code);
- return $this->huoSuccess($code, $_msg, $data);
- }
- /**
- * @param $code
- *
- * @return mixed
- */
- protected function retErrMsg($code) {
- $_err_msg = IdentifyStatus::getMsg($code);
- return $this->huoError($code, $_err_msg);
- }
- }
|