123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- 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 {
-
- 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);
- }
-
- protected function retSucMsg($code, $data = []) {
- $_msg = IdentifyStatus::getMsg($code);
- return $this->huoSuccess($code, $_msg, $data);
- }
-
- protected function retErrMsg($code) {
- $_err_msg = IdentifyStatus::getMsg($code);
- return $this->huoError($code, $_err_msg);
- }
- }
|