quanwei
2 days ago 04102f7237efefa744090ed7c25f7b5d0807b679
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
 
namespace app\common\model\user;
 
use app\common\model\BaseModel;
use app\common\service\order\OrderService;
 
/**
 * 用户详细信息模型
 */
class UserAuth extends BaseModel
{
    protected $pk = 'auth_id';
    protected $name = 'user_auth';
 
    /**
     * 法人正面照
     * @return \think\model\relation\HasOne
     */
    public function idCardFrontPhoto()
    {
        return $this->hasOne('app\\common\\model\\file\\UploadFile', 'file_id', 'legal_person_id_card_front_photo_id');
    }
    /**
     * 法人反面照
     * @return \think\model\relation\HasOne
     */
    public function idCardBackPhoto()
    {
        return $this->hasOne('app\\common\\model\\file\\UploadFile', 'file_id', 'legal_person_id_card_back_photo_id');
    }
    /**
     * 营业执照
     * @return \think\model\relation\HasOne
     */
    public function licensePhoto()
    {
        return $this->hasOne('app\\common\\model\\file\\UploadFile', 'file_id', 'license_photo_id');
    }
    /**
     * 结算人正面照
     * @return \think\model\relation\HasOne
     */
    public function settlementIdCardFrontPhoto()
    {
        return $this->hasOne('app\\common\\model\\file\\UploadFile', 'file_id', 'settlement_person_id_card_front_photo_id');
    }
    /**
     * 结算人正面照
     * @return \think\model\relation\HasOne
     */
    public function settlementIdCardBackPhoto()
    {
        return $this->hasOne('app\\common\\model\\file\\UploadFile', 'file_id', 'settlement_person_id_card_back_photo_id');
    }
    /**
     * 结算银行卡
     * @return \think\model\relation\HasOne
     */
    public function bankCardPhoto()
    {
        return $this->hasOne('app\\common\\model\\file\\UploadFile', 'file_id', 'bank_card_photo_id');
    }
    /**
     * 门店照
     * @return \think\model\relation\HasOne
     */
    public function storeFrontPhoto()
    {
        return $this->hasOne('app\\common\\model\\file\\UploadFile', 'file_id', 'store_front_img_url_id');
    }
    /**
     * 收银台照
     * @return \think\model\relation\HasOne
     */
    public function storeCashPhoto()
    {
        return $this->hasOne('app\\common\\model\\file\\UploadFile', 'file_id', 'store_cash_photo_id');
    }
    /**
     * 店内环境照
     * @return \think\model\relation\HasOne
     */
    public function storeEnvPhoto()
    {
        return $this->hasOne('app\\common\\model\\file\\UploadFile', 'file_id', 'store_env_photo_id');
    }
 
    /**
     * 详情
     */
    public static function detailById($where, $with = ['user'])
    {
        is_array($where) ? $filter = $where : $filter['auth_id'] = (int)$where;
        return (new static())->with($with)->find($where);
    }
 
    /**
     * 生成订单号
     */
    public function orderNo()
    {
        return OrderService::createOrderNo();
    }
}