123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <?php
- /**
- * IdentifyOrderModel.php UTF-8
- *
- * @date : 2021/3/20 15:38
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : chenbingling <cbl@huosdk.com>
- * @version : HUOSDK-9.0
- */
- namespace huoIdentify\model;
- use huo\model\common\CommonModel;
- use huolib\constant\CacheConst;
- class IdentifyOrderModel extends CommonModel {
- protected $name = 'identify_order';
- protected $pk = 'id';
- /* 开启自动写入时间戳字段 */
- protected $autoWriteTimestamp = true;
- protected $cache_key_prefix = CacheConst::CACHE_IDENTIFY_ORDER_PREFIX;
- protected $type
- = [
- 'id' => 'integer',
- 'ai' => 'string',
- 'mem_id' => 'integer',
- 'biz_id' => 'string',
- 'real_name' => 'string',
- 'id_card' => 'string',
- 'status' => 'integer',
- 'create_time' => 'timestamp',
- 'update_time' => 'timestamp',
- ];
- /**
- * 获取单条记录缓存key
- *
- * @param int $id ID
- *
- * @return string :string
- */
- protected function getSingleCacheKey($id) {
- return $this->cache_key_prefix.$id;
- }
- /**
- * 通过ID获取信息
- *
- * @param int $id 主键ID
- *
- * @return array
- */
- public function getInfoById($id) {
- $_data = parent::getInfoById($id);
- return $_data;
- }
- /**
- * 加入数据库
- *
- * @param array $data
- *
- * @return bool|int
- */
- public function addData($data) {
- $_data = $data;
- $_rs = parent::addData($_data);
- if (empty($_rs)) {
- return false;
- }
- return $_rs;
- }
- /**
- * 更新单条数据
- *
- * @param array $data 数据
- * @param int $id ID
- *
- * @return bool
- */
- public function updateData($data, $id) {
- $_data = $data;
- $_rs = parent::updateData($_data, $id);
- if (false === $_rs) {
- return false;
- }
- return true;
- }
- /**
- * 获取认证中的ai
- *
- * @param $biz_id
- * @param $mem_id
- *
- * @return array|false
- */
- public function getLastInfoByBizIdMem($biz_id, $mem_id) {
- $_map = [
- 'biz_id' => $biz_id,
- 'mem_id' => $mem_id,
- ];
- $_field = ['ai', 'real_name', 'id_card','status'];
- $_info = $this->where($_map)->order('id desc')->field($_field)->find();
- if (is_object($_info)) {
- $_info = $_info->toArray();
- }
- return $_info;
- }
- /**
- * 关联玩家
- */
- public function mem() {
- $_field = [
- 'id',
- 'username'
- ];
- return $this->belongsTo('\huo\model\member\MemberModel', 'mem_id', 'id')->field($_field);
- }
- }
|