94 lines
2.2 KiB
PHP
94 lines
2.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2020-11-5
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
|
|
namespace app\modules\store\models\report;
|
|
|
|
use app\components\EncryptHelper;
|
|
use app\components\FlashStorage;
|
|
use app\models\Admin;
|
|
use app\models\auth\RoleUser;
|
|
use app\models\CardUnion;
|
|
use app\models\District;
|
|
use app\models\Model;
|
|
use app\models\StoreUser;
|
|
use app\models\SysAdmin;
|
|
use app\models\User;
|
|
use app\modules\store\models\AdminModel;
|
|
use app\models\common\CommonUserEditForm;
|
|
use app\modules\api\models\StoreCityForm;
|
|
use PHPUnit\Util\Log\JSON;
|
|
use Wechat\Wechat;
|
|
|
|
class ReportEditForm extends AdminModel
|
|
{
|
|
|
|
public $store_id;
|
|
|
|
public $model;
|
|
public $final_path;
|
|
public $user_type;
|
|
public $left_img;
|
|
public $right_img;
|
|
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['final_path','right_img','left_img'], 'string'],
|
|
// [['final_path'], 'required'],
|
|
];
|
|
}
|
|
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'final_path' => '上传模型',
|
|
];
|
|
}
|
|
|
|
|
|
public function edit()
|
|
{
|
|
if (!$this->validate()) {
|
|
return $this->getModelError();
|
|
}
|
|
|
|
if ($this->user_type == 1) {
|
|
$this->model->initial_path = $this->final_path;
|
|
$this->model->step = 1;
|
|
$this->model->initial_at = time();
|
|
} else {
|
|
$this->model->final_path = $this->final_path;
|
|
$this->model->step = 2;
|
|
$this->model->final_at = time();
|
|
}
|
|
$json = [];
|
|
if(!empty($this->model->json)){
|
|
$json = json_decode($this->model->json,true);
|
|
}
|
|
$json['left_img'] = $this->left_img;
|
|
$json['right_img'] = $this->right_img;
|
|
$json['updated_at'] = time();
|
|
if(!empty($this->left_img) && !empty($this->right_img)){
|
|
$this->model->step = 2;
|
|
}else{
|
|
$this->model->step = 0;
|
|
}
|
|
$this->model->json = json_encode($json,JSON_UNESCAPED_UNICODE);
|
|
|
|
if (!$this->model->save()) {
|
|
return $this->getModelError($this->model);
|
|
}
|
|
return $this->apiReturnSuccess('上传成功');
|
|
}
|
|
|
|
|
|
} |