|
@@ -3,8 +3,7 @@ declare (strict_types = 1);
|
|
|
|
|
|
namespace app\txx\controller;
|
|
|
|
|
|
-use app\BaseController;
|
|
|
-use think\facade\Validate;
|
|
|
+use app\txx\model\ActGood;use think\facade\Validate;
|
|
|
use app\txx\model\Act as Actm;
|
|
|
use think\App;
|
|
|
|
|
@@ -13,6 +12,7 @@ class Act extends Base
|
|
|
protected $uid=0;
|
|
|
protected $uname='';
|
|
|
protected $model;
|
|
|
+ protected static $ActStatusCn=["无状态",'活动未开始','活动进行中',"活动已结束"];
|
|
|
public function __construct(App $app) {
|
|
|
parent::__construct($app);
|
|
|
if($this->request->isCx==1){
|
|
@@ -65,6 +65,7 @@ class Act extends Base
|
|
|
->paginate(["list_rows"=>$param['size'],"page"=>$param['page']])
|
|
|
->each(function(&$item){
|
|
|
$item['act_status']=time()< strtotime($item['startTime'])?1:(time()> strtotime($item['endTime'])?3:2);
|
|
|
+ $item['act_status_cn'] = self::$ActStatusCn[$item['act_status']];
|
|
|
});
|
|
|
$this->success("获取成功",["list"=>$list->items(),"count"=>$list->total()]);
|
|
|
}
|
|
@@ -144,11 +145,11 @@ class Act extends Base
|
|
|
'contactor|联系人' => 'require|max:255',
|
|
|
'mobile|联系电话' => 'require',
|
|
|
]);
|
|
|
- if($validate->check($param)==false)return json_show(1004,$validate->getError());
|
|
|
+ if($validate->check($param)==false)$this->error($validate->getError());
|
|
|
$actm=new Actm();
|
|
|
$info = $actm->where(["actCode"=>$param['actCode'],"is_del"=>0])->find();
|
|
|
- if($info->isEmpty()) return json_show(1005,"活动不存在");
|
|
|
- if($info->status==1) return json_show(1005,"活动已发布,不能编辑");
|
|
|
+ if($info->isEmpty())$this->error("活动不存在");
|
|
|
+ if($info->status==1)$this->error("活动已发布,不能编辑");
|
|
|
|
|
|
$data=[
|
|
|
"act_name"=>$param['act_name'],
|
|
@@ -180,6 +181,13 @@ class Act extends Base
|
|
|
if($validate->check($param)==false)$this->error($validate->getError());
|
|
|
|
|
|
$info = $this->model->with(["goodInfo"])->where(["actCode"=>$param['actCode'],"is_del"=>0])->findOrEmpty();
|
|
|
+ if($info->isEmpty()) $this->error("活动不存在");
|
|
|
+ $info['act_status']=time()< strtotime($info['startTime'])?1:(time()> strtotime($info['endTime'])?3:2);
|
|
|
+ $info['goodInfo']->each(function(&$item){
|
|
|
+ $item['status_cn']=ActGood::$statusCn[$item['status']]??'';
|
|
|
+ });
|
|
|
+ $info['statusCn'] = \app\txx\model\Act::$statusCn[$info['status']]??'';
|
|
|
+ $info['act_status_cn']=self::$ActStatusCn[$info['act_status']];
|
|
|
$this->success("获取成功",$info);
|
|
|
}
|
|
|
|