[ 'class' => LoginBehavior::className(), ], ]); } //门店列表 public function actionIndex() { if (\Yii::$app->request->isAjax) { $form = new StoreListForm(); $form->attributes = \Yii::$app->request->get(); $data = $form->search(); return $this->responseHandler($data); } $district = District::getTerritorial(); $district = (new Serializer())->encode($district); return $this->render('index', [ 'district' => $district, ]); } //绑定记录 public function actionBind() { $time = time(); $date = date('Y-m-d H:00:00', $time - 60 * 60 * 12) . " - " . date('Y-m-d H:00:00', $time); $store = Store::find()->select('id,name')->where(['is_delete' => 0])->asArray()->all(); return $this->render('bind', [ 'store' => $store, 'date' => $date, ]); } /** * @ Author : Lw * @ CreateTime : 2022-11-15 * @ Info : 获取场地扫码数据 */ public function actionGetCdQrData() { $obj = new StoreEaringsListForm(); $get = \Yii::$app->request->get(); $get['store_id'] = \Yii::$app->store->identity->store_id;; $obj->attributes = $get; $res = $obj->getStoreList(); return $this->responseHandler($res); } //门店人员管理创建/编辑 public function actionStoreUserEdit($id = 0) { $model = StoreUser::findOne([ 'id' => $id, 'is_delete' => 0 ]); if ($model == null) $model = new StoreUser(); if (\Yii::$app->request->isPost) { $form = new StoreUserEditForm(); $form->attributes = \Yii::$app->request->post(); $form->model = $model; $form->cx_mch_id = $this->cx_mch_id; $form->store_id = \Yii::$app->store->identity->store_id; $form->creator_user_id = \Yii::$app->admin->identity->user_id; $data = $form->edit(); return $this->responseHandler($data); } if ($model != null) { $user = User::findOne(['id' => $model->user_id]); } else { $user = new User(); } $store = Store::find()->where(['is_delete' => 0])->asArray()->all(); return $this->render('store-user-edit', [ 'store' => $store, 'password' => '12345678', 'model' => $model, 'user' => $user ]); } //门店人员管理 public function actionStoreUser() { if (\Yii::$app->request->isAjax) { $form = new StoreUserListForm(); $form->attributes = \Yii::$app->request->get(); $form->store_id = \Yii::$app->store->identity->store_id; $form->id = \Yii::$app->store->identity->id; $data = $form->search(); return $this->responseHandler($data); } return $this->render('store-user'); } //门店收益 public function actionStoreEarings() { $get = \Yii::$app->request->get(); $store_id = \Yii::$app->store->identity->store_id; if (\Yii::$app->request->isAjax) { $form = new StoreEaringsListForm(); $form->attributes = $get; $form->store_id = $store_id; $data = $form->search(); return $this->responseHandler($data); } $start_time = !empty($get['start_time']) ? strtotime($get['start_time']) : 0; $end_time = !empty($get['end_time']) ? strtotime($get['end_time']) : time(); $sum = StoreEarnings::find()->where(['between', 'created_at', $start_time, $end_time])->andWhere([ 'store_id' => $store_id, 'is_delete' => 0, ])->sum('money')??0; return $this->render('earings', [ 'store_money' => round($sum,2), ]); } }