| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <?php
- /**
- * 厦门云联储网络科技有限公司
- * https://www.baokuaiyun.com
- * Copyright (c) 2023 爆块云 All rights reserved.
- */
- namespace app\models;
- /**
- * Class StoreAliMini
- * @package app\models
- * @property integer $id
- * @property integer $store_id
- * @property string $auth_code
- * @property string $auth_token
- * @property string $userid
- * @property integer $is_cancel
- * @property string $auth_app_id
- * @property string $refresh_token
- * @property string $aes_key
- * @property integer $is_merchant
- * @property string $license_no
- * @property string $license_pic
- * @property string $app_name
- * @property string $app_english_name
- * @property string $app_slogan
- * @property string $app_logo
- * @property string $app_desc
- * @property string $aweme_id
- * @property string $service_phone
- * @property string $service_email
- * @property string $mini_categoryIds
- * @property string $license_name
- * @property string $license_date
- * @property string $category_name
- * @property integer $is_long_effective
- * @property string $alipay_account
- * @property string $legal_personal_name
- * @property string $contact_name
- * @property string $order_no
- * @property string $order_no_ali
- * @property integer $order_cancel
- * @property integer $category_data
- * @property string $batch_no
- * @property integer $batch_status
- * @property string $store_face_photo
- * @property integer $is_get_phone
- * @property string $apply_phone_msg
- * @property string $apply_phone_fail
- * @property string $other_data
- * @property integer $is_use
- * @property integer $shop_status
- * @property integer $bind_food_qr
- *
- *
- *
- **/
- class StoreDouyinMini extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%store_douyin_mini}}';
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => "ID",
- 'store_id' => "商户ID",
- 'auth' => "授权",
- 'auth_app_id' => "小程序ID",
- 'is_cancel' => "是否取消授权",
- "is_merchant"=> "是否为商户",
- "license_no"=> "营业执照编号",
- "license_pic"=> "营业执照",
- "app_name"=> "小程序名称",
- "app_english_name"=> "小程序英文名称",
- "app_slogan"=> "小程序应用简介",
- "app_logo"=> "小程序LOGO",
- "app_desc"=> "小程序应用描述",
- "aweme_id"=> "引导关注抖音号",
- "service_phone"=> "客服手机号",
- "service_email"=> "客服邮箱",
- "mini_categoryIds"=> "分类ID",
- "license_name"=> "营业执照名称",
- "license_date"=> "有效期",
- "category_name"=> "分类名称",
- "is_long_effective"=> "是否长期有效",
- "legal_personal_name"=> "商家法人名称",
- "contact_name"=> "商家联系人名称",
- "category_data"=> "分类数据",
- "store_face_photo"=> "门头照",
- "is_get_phone"=> "获取手机号权限状态",
- "apply_phone_msg"=> "申请手机号信息资料",
- "apply_phone_fail"=> "申请手机号失败信息",
- 'other_data'=> "其他申请资料",
- 'is_use' => "是否使用",
- 'bind_food_qr' => "是否绑定点餐码"
- ];
- }
-
- public static function authUpdate($mini_id, $auth) {
- $appid = $auth['authorizer_appid'];
- if($mini_id){
- $mini = self::findOne($mini_id);
- }else{
- $mini = self::findOne(['auth_app_id' => $appid]);
- }
- if(!$mini){
- $mini = new StoreDouyinMini();
- $mini->auth_app_id = $appid;
- }
- $init = 1;
- if((empty($mini->auth) || empty($mini->app_name)) && $auth){
- $init = 1;
- }
- $auth && $mini->auth = json_encode($auth);
- $auth['store_id'] && $mini->store_id = $auth['store_id'];
- if($mini->save()){
- return [
- 'code' => 0,
- 'data' => $mini,
- ];
- }else{
- \Yii::error(array_shift($mini->getFirstErrors()));
- return [
- 'code' => 0,
- 'data' => $mini,
- 'msg' => 'StoreDouyinMini数据保存失败,' . array_shift($mini->getFirstErrors()),
- ];
- }
- }
- }
|