diff --git a/common/libs/MyLib.php b/common/libs/MyLib.php index 8c8b0aa..2683be1 100644 --- a/common/libs/MyLib.php +++ b/common/libs/MyLib.php @@ -40,50 +40,11 @@ class MyLib { static public function substr_cut($str_cut,$length) { $string = trim($str_cut); - if($length && strlen($string) > $length) { - //截断字符 - $wordscut = ''; + $len = mb_strlen($string, 'utf-8'); + if($length && $len > $length) { //utf8编码 - $n = 0; - $tn = 0; - $noc = 0; - while ($n < strlen($string)) { - $t = ord($string[$n]); - if($t == 9 || $t == 10 || (32 <= $t && $t <= 126)) { - $tn = 1; - $n++; - $noc++; - } elseif(194 <= $t && $t <= 223) { - $tn = 2; - $n += 2; - $noc += 2; - } elseif(224 <= $t && $t < 239) { - $tn = 3; - $n += 3; - $noc += 2; - } elseif(240 <= $t && $t <= 247) { - $tn = 4; - $n += 4; - $noc += 2; - } elseif(248 <= $t && $t <= 251) { - $tn = 5; - $n += 5; - $noc += 2; - } elseif($t == 252 || $t == 253) { - $tn = 6; - $n += 6; - $noc += 2; - } else { - $n++; - } - if ($noc >= $length) { - break; - } - } - if ($noc > $length) { - $n -= $tn; - } - $wordscut = substr($string, 0, $n); + $wordscut = mb_substr($string, 0, $length); + $string = $wordscut.'...'; } return trim($string); diff --git a/common/models/GiftT.php b/common/models/GiftT.php index 1fb1212..26d42af 100644 --- a/common/models/GiftT.php +++ b/common/models/GiftT.php @@ -60,14 +60,53 @@ class GiftT extends \common\models\Base ]; } - public function getType() + public function getShowType() { - return $this->hasOne(GiftTypeT::className(),['id'=>'type_id']); + if($this->type_id == 1) return '实名礼品'; + if($this->type_id == 2) return '礼券'; + return ''; } - public function getStrategys() + public function getTickets() { - return $this->hasMany(StrategyT::className(),['id'=>'strategy_id']) - ->viaTable('gift_strategy_t',['gift_id'=>'id']); + return $this->hasMany(GiftTicketT::className(),['type_id'=>'id']); + } + public function getTicketsUse() + { + return $this->hasMany(GiftTicketTUse::className(),['type_id'=>'id']); + } + + public function getTicketsUseByDate($date_type,$begin_date,$end_date) + { + $query = GiftTicketTUse::find() + ->leftJoin('order_t','order_t.id=gift_ticket_t_use.order_id') + ->leftJoin('gift_t','gift_t.id=gift_ticket_t_use.type_id') + ->where('gift_t.id='.$this->id) + ->orderBy('id DESC'); + + if($date_type == 1) { + if($begin_date != '') { + $query = $query->andWhere('gift_ticket_t_use.finished_date>="' . $begin_date.'"'); + } + if($end_date != '') { + $query = $query->andWhere('gift_ticket_t_use.finished_date<="' . $end_date.'"'); + } + }elseif ($date_type == 2){ + if($begin_date != '') { + $query = $query->andWhere('order_t.print_date>="' . $begin_date.'"'); + } + if($end_date != '') { + $query = $query->andWhere('order_t.print_date<="' . $end_date.'"'); + } + }elseif ($date_type == 3){ + if($begin_date != '') { + $query = $query->andWhere('order_t.submit_date>="' . $begin_date.'"'); + } + if($end_date != '') { + $query = $query->andWhere('order_t.submit_date<="' . $end_date.'"'); + } + } + + return $query; } } diff --git a/common/models/GiftTicketTUse.php b/common/models/GiftTicketTUse.php new file mode 100644 index 0000000..8f95b20 --- /dev/null +++ b/common/models/GiftTicketTUse.php @@ -0,0 +1,100 @@ + 100], + [['car_no'], 'string', 'max' => 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'code' => 'Code', + 'type_id' => 'Type ID', + 'group_id' => 'Group ID', + 'car_no' => 'Car No', + 'input_date' => 'Input Date', + 'use_date' => 'Use Date', + 'end_date' => 'End Date', + 'status' => 'Status', + 'op_id' => 'Op ID', + 'created_at' => 'Created At', + 'updated_at' => 'Updated At', + ]; + } + public function getStatus() { + $type_id = $this->typeNew->type_id; + $status = $this->status; + + if($type_id == 1 && $status == 1) { + return '未出库'; + }elseif($type_id == 1 && $status == 3) { + return '已出库'; + }elseif($type_id == 2 && $status == 1){ + return '未使用'; + }elseif ($type_id == 2 && $status == 2){ + return '使用中'; + }elseif ($type_id == 2 && $status == 3){ + return '使用完'; + }else{ + return '未定义'; + } + } + public function getTypeNew() { + return $this->hasOne(GiftT::className(),['id'=>'type_id']); + } + + + public function getUser() { + return $this->hasOne(UserT::className(),['id'=>'user_id']); + } + public function getOp() { + return $this->hasOne(UserT::className(),['id'=>'op_id']); + } + + public function getOrder(){ + return $this->hasOne(OrderT::className(),['id'=>'order_id']); + } +} diff --git a/common/models/UserT.php b/common/models/UserT.php index 734f89c..3330e70 100644 --- a/common/models/UserT.php +++ b/common/models/UserT.php @@ -33,9 +33,6 @@ use Yii; * @property string $created_at * @property string $updated_at * @property integer $is_double - * @property string $business_group_id - * @property integer $department_id - * @property integer $company_id * @property integer $is_outer */ class UserT extends \common\models\Base @@ -55,7 +52,7 @@ class UserT extends \common\models\Base { return [ [['username', 'password', 'salt','role_id'], 'required'], - [['login_time', 'is_delete', 'is_locked', 'is_login', 'is_send', 'group_id','phone_server_id','role_id','worktype_id','is_leave','business_group_id', 'is_double','department_id','company_id'], 'integer'], + [['login_time', 'is_delete', 'is_locked', 'is_login', 'is_send', 'group_id','phone_server_id','role_id','worktype_id','is_leave', 'is_double'], 'integer'], [['created_at', 'updated_at'], 'safe'], [['username', 'password', 'name'], 'string', 'max' => 100], [['salt'], 'string', 'max' => 4], @@ -92,10 +89,7 @@ class UserT extends \common\models\Base 'try_pay' => 'Try Pay', 'try_rate' => 'Try Rate', 'worktype_id' => 'Work Type', - 'business_group_id' => 'Business Group Id', 'is_leave' => 'Is Leave', - 'department_id' => 'Department ID', - 'company_id' => 'Company ID', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; @@ -250,20 +244,6 @@ class UserT extends \common\models\Base return $user_ids; } - public function getBusinessGroup() - { - return $this->hasOne(BusinessGroupT::className(),['id' => 'business_group_id']); - } - - public function getDepartment() - { - return $this->hasOne(DepartmentT::className(),['id'=>'department_id']); - } - - public function getCompany() - { - return $this->hasOne(CompanyT::className(),['id'=>'company_id']); - } public function getChildrenClean($otherSql = '',$isAdmin=0) { if($otherSql != '') diff --git a/common/models/ZhongjiTiaojian.php b/common/models/ZhongjiTiaojian.php new file mode 100644 index 0000000..6110467 --- /dev/null +++ b/common/models/ZhongjiTiaojian.php @@ -0,0 +1,117 @@ + 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'baofei' => 'Baofei', + 'xianzhong_one' => 'Xianzhong One', + 'xianzhong_two' => 'Xianzhong Two', + 'car_type_id' => 'Car Type ID', + 'car_use_id' => 'Car Use ID', + 'type' => 'Type', + 'created_at' => 'Created At', + 'updated_at' => 'Updated At', + ]; + } + public function getFanxian() + { + return $this->hasMany(ZhongjiFanxianT::className(),['tiaojian_id'=>'id']); + } + public function getTicheng() + { + return $this->hasMany(ZhongjiTichengT::className(),['tiaojian_id'=>'id']); + } +} diff --git a/common/models/ZhongjiYingxiao.php b/common/models/ZhongjiYingxiao.php new file mode 100644 index 0000000..caf41be --- /dev/null +++ b/common/models/ZhongjiYingxiao.php @@ -0,0 +1,159 @@ + 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'celuo_name' => 'Celuo Name', + 'begin_date' => 'Begin Date', + 'end_date' => 'End Date', + 'baofei' => 'Baofei', + 'xianzhong_one' => 'Xianzhong One', + 'xianzhong_two' => 'Xianzhong Two', + 'car_type_id' => 'Car Type ID', + 'car_use_id' => 'Car Use ID', + 'created_at' => 'Created At', + 'updated_at' => 'Updated At', + ]; + } + +// public function getId() +// { +// return $this->id; +// } + public function getFanxian() + { + return $this->hasMany(ZhongjiFanxianT::className(),['celuo_id'=>'id']); + } + + public function getKehufanxian() + { + return ZhongjiFanxianT::find()->where(['celuo_id'=>$this->id,'fanxian_type'=>1])->one(); + + } + + public function getXianzhongfanxian($id) + { + return ZhongjiFanxianT::find()->where(['celuo_id'=>$id,'fanxian_type'=>2])->all(); + } + + public function getXianzhongfanxianTwo($id) + { + return ZhongjiFanxianT::find()->where(['celuo_id'=>$id,'fanxian_type'=>3])->one(); + } + public function getXianzhongfanxianOne($id) + { + return ZhongjiFanxianT::find()->where(['celuo_id'=>$id,'fanxian_type'=>5])->one(); + } + public function getnogift($id = 0) + { + return ZhongjiFanxianT::find()->where(['celuo_id'=>$this->id,'fanxian_type'=>4])->one(); + } + + public function getKehuticheng($id) + { + return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>1])->one(); + } + public function getOnlineticheng($id) + { + return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>2])->one(); + } + public function getXianzhongticheng($id) + { + return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>3])->all(); + } + + public function getXianzhongtichengTwo($id) + { + return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>4])->one(); + } + public function getXianzhongtichengOne($id) + { + return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>5])->one(); + } + public function getnogiftTicheng($id) + { + return ZhongjiTichengT::find()->where(['celuo_id'=>$id,'ticheng_type'=>6])->one(); + } + public function getGiftNonetwo($id) + { + return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>1,'free_type'=>4])->all(); + } + public function getQuanNonetwo($id) + { + return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>2,'free_type'=>4])->all(); + } + public function getGiftNone($id) + { + return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>1,'free_type'=>3])->all(); + } + public function getQuanNone($id) + { + return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>2,'free_type'=>3])->all(); + } + public function getGiftfree($id) + { + return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>1,'free_type'=>1])->all(); + } + public function getQuanfree($id) + { + return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>2,'free_type'=>1])->all(); + } + public function getGiftMoney($id) + { + return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>1,'free_type'=>2])->all(); + } + public function getQuanMoney($id) + { + return ZhongjiGiftT::find()->where(['celuo_id'=>$id,'gift_type'=>2,'free_type'=>2])->all(); + } + + + + + +} diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index 34e06a7..bd19666 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -68,6 +68,9 @@ use yii\web\Response; class CarController extends BaseController { + public $enableCsrfValidation = false; + public $layout = 'blue-main'; + public function actionIndex() { return $this->renderPartial('index'); @@ -550,7 +553,10 @@ class CarController extends BaseController if($id > 0) { $car_info = CarT::findOne(['id'=>$id]); - + if($car_info->location != 1) { + $result['msg'] = '该车辆必须先回到A库,才能删除'; + return $result; + } //删除预约信息 AppointmentT::deleteAll('car_id='.$id); AppointmentHistoryT::deleteAll('car_id='.$id); @@ -583,7 +589,7 @@ class CarController extends BaseController } catch(\Exception $e) { $tran->rollBack(); - throw $e; + $result['msg'] = $e->getMessage(); } } return $result; diff --git a/frontend/controllers/CommonController.php b/frontend/controllers/CommonController.php index df7ffc5..3d8ba01 100644 --- a/frontend/controllers/CommonController.php +++ b/frontend/controllers/CommonController.php @@ -13,9 +13,11 @@ use common\models\GroupT; use common\models\SysIpT; use Yii; use yii\helpers\ArrayHelper; +use yii\helpers\FileHelper; use yii\helpers\Json; use yii\web\Cookie; use yii\web\Response; +use yii\web\UploadedFile; use yii\web\User; class CommonController extends \yii\web\Controller @@ -361,6 +363,21 @@ class CommonController extends \yii\web\Controller } + public function actionUpload(){ + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $data = array(); + $data['status'] = 'FAILSE'; + $data['fileUrl'] = ''; + if($request->isPost){ + $img = UploadedFile::getInstanceByName('img'); + $filename = 'upload/images/'.date('Ym').'/'.time().rand(1111,9999).'.'.$img->extension; + FileHelper::createDirectory(dirname($filename)); + $img->saveAs($filename); - + $data['status'] = 'SUCCESS'; + $data['fileUrl'] = '/'.$filename; + } + return $data; + } } diff --git a/frontend/controllers/DatabaseController.php b/frontend/controllers/DatabaseController.php index 2784cb4..b475678 100644 --- a/frontend/controllers/DatabaseController.php +++ b/frontend/controllers/DatabaseController.php @@ -39,11 +39,14 @@ use common\models\UserT; use common\models\InvalidNew; use Yii; use yii\data\Pagination; +use yii\db\Exception; use yii\web\Response; use yii\db\Expression; class DatabaseController extends BaseController -{ +{ + public $enableCsrfValidation = false; + public $layout = 'blue-main'; //A库query @@ -51,7 +54,6 @@ class DatabaseController extends BaseController private function getAQuery($request) { if($request->isPost) { - $car_man = $request->post('car_man'); $phone = $request->post('phone'); $car_no = $request->post('car_no'); @@ -154,142 +156,112 @@ class DatabaseController extends BaseController $libs[] = 1; } if(count($libs) > 0) - $query = $query->andWhere(['in','location',$libs]); + $query->andWhere(['in','location',$libs]); if($car_man != '') { - $query = $query->andWhere('car_man like "'.$car_man.'"'); + $query->andWhere('car_man like "'.$car_man.'"'); } if($phone != '') { - $query = $query->andWhere('phone like "'.$phone.'"'); + $query->andWhere('phone like "'.$phone.'"'); } if($car_no != '') { - $query = $query->andWhere('car_no like "'.$car_no.'%"'); + $query->andWhere('car_no like "'.$car_no.'%"'); } if($engine_no != '') { - $query = $query->andWhere('engine_no="'.$engine_no.'"'); + $query->andWhere('engine_no="'.$engine_no.'"'); } if($car_frame_no != '') { - $query = $query->andWhere('car_frame_no="'.$car_frame_no.'"'); + $query->andWhere('car_frame_no="'.$car_frame_no.'"'); } if($register_begin != '') { - $query = $query->andWhere('register_date>="'.$register_begin.'"'); + $query->andWhere('register_date>="'.$register_begin.'"'); } if($register_end != '') { - $query = $query->andWhere('register_date<="'.$register_end.'"'); + $query->andWhere('register_date<="'.$register_end.'"'); } if($insurer1_begin != '') { - $query = $query->andWhere('insurer1_date>="'.$insurer1_begin.'"'); + $query->andWhere('insurer1_date>="'.$insurer1_begin.'"'); } if($insurer1_end != '') { - $query = $query->andWhere('insurer1_date<="'.$insurer1_end.'"'); + $query->andWhere('insurer1_date<="'.$insurer1_end.'"'); } if($insurer1_month != '') { - $query = $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"'); + $query->andWhere('month(car_t.insurer1_date)>="'.$insurer1_month.'"'); } if($insurer1_day != '') { - $query = $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"'); + $query->andWhere('day(car_t.insurer1_date)>="'.$insurer1_day.'"'); } if($insurer1_month1 != '') { - $query = $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"'); + $query->andWhere('month(car_t.insurer1_date)<="'.$insurer1_month1.'"'); } if($insurer1_day1 != '') { - $query = $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"'); + $query->andWhere('day(car_t.insurer1_date)<="'.$insurer1_day1.'"'); } if($clean_right != '') { - $query = $query->andWhere('car_t.clean_right="'.$clean_right.'"'); + $query->andWhere('car_t.clean_right="'.$clean_right.'"'); } if($biaozhu != '') { - $query = $query->andWhere('car_t.biaozhu="'.$biaozhu.'"'); + $query->andWhere('car_t.biaozhu="'.$biaozhu.'"'); } if($has_phone == 1) { - $query = $query->andWhere('phone<>""'); + $query->andWhere('phone<>""'); } if($no_insurerdate == 1) { - $query = $query->andWhere('insurer1_date="" or insurer1_date is null or insurer1_date="0000-00-00"'); + $query->andWhere('insurer1_date="" or insurer1_date is null or insurer1_date="0000-00-00"'); } if($company != '') { - $query = $query->andWhere('company like "'.$company.'%"'); + $query->andWhere('company like "'.$company.'%"'); } if($user1 != '') { - $query = $query->andWhere('op_user1 like "'.$user1.'%"'); + $query->andWhere('op_user1 like "'.$user1.'%"'); } return ['query'=>$query,'params'=>$params]; } + + public function actionAIndex() { + $invalid_items = InvalidT::getTree(); + return $this->render('a-index',[ + 'invalid_items' => $invalid_items + ]); + } + + public function actionASearch() { + return $this->render('a-index-search'); + } + // 2018.4.4 修改 A库浏览 - public function actionAIndex() + public function actionAIndexJson() { + Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; - $page = $request->get('page',1); - $op = $request->get('op',1); + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); $data = $this->getAQuery($request); - $query = $data['query']; - $params = $data['params']; - $params['page'] = $page; - if($op==0) { - $query = $query->andWhere('car_t.id=-1'); - } -// echo $query->createCommand()->rawSql; + $query = $data['query']; +// $query->andWhere('location=1'); $total = $query->count(); - $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]); - $pagination->setPage($page-1); - - $query = $query->offset($pagination->offset)->limit($pagination->limit); + $query->orderBy('id desc'); + $query = $query->offset($offset)->limit($limit); $items = $query->all(); -// foreach($items as $k=>$v){ -// $car_content=CarInfoT::findOne(['car_id'=>$v->id]); -// if(!$car_content){ -// $order=new CarInfoT(); -// $order->car_id =$v->id; -// $order->car_no =$v->car_no; -// $order->engine_no =$k.$v->id; -// $order->car_frame_no =$k.$v->id; -// $order->register_date ='2019-04-11'; -// $order->factory_model =$k.$v->id; -// $order->series_name =$k.$v->id; -// $order->cartype_name =$k.$v->id; -// $order->car_year =$k.$v->id; -// $order->displacement_name =$k.$v->id; -// $order->save(); -// } -// -// $kehu_info=KehuT::findOne(['car_id'=>$v->id]); -// if(!$kehu_info){ -// $kehu_info=new KehuT(); -// $kehu_info->car_id=$v->id; -// $kehu_info->car_no=$v->car_no; -// $kehu_info->car_man_number=$v->id.$k; -// $kehu_info->car_phone=$v->id.$k; -// $kehu_info->car_now_addr=$v->id.$k; -// $kehu_info->car_id_addr=$v->id.$k; -// $kehu_info->id_man=$v->id.$k; -// $kehu_info->id_number=$v->id.$k; -// $kehu_info->id_phone=$v->id.$k; -// $kehu_info->id_now_addr=$v->id.$k; -// $kehu_info->id_addr=$v->id.$k; -// $kehu_info->save(); -// -// } -// } -// die; - $page_info = MyLib::getPageInfo($pagination); - - $invalid_items = InvalidT::getTree(); - - $params['items'] = $items; - $params['page_info'] = $page_info; - $params['invalid_items'] = $invalid_items; -// $params['month'] = CarT::MONTH; -// $params['days'] = CarT::DAYS; - - - return $this->render('a-index',$params); + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $row['factory_model'] = MyLib::substr_cut($item->factory_model, 8); + $row['car_man'] = MyLib::substr_cut($item->car_man, 8); + $row['location'] = $item->getLocation(); + $data['rows'][] = $row; + } + return $data; } + public function actionKufangIndex() { $request = Yii::$app->request; @@ -382,7 +354,7 @@ class DatabaseController extends BaseController $result['msg'] = '操作失败'; if($request->isPost) { - $ids = $request->post('ids',array()); + $ids = explode(',',$request->post('ids')); if(count($ids) == 0) { $result['msg'] = '请先钩选车辆'; return $result; @@ -393,18 +365,19 @@ class DatabaseController extends BaseController foreach($ids as $id) { $car_info = CarT::findOne(['id'=>$id]); if($car_info->location == 1) { -// if($car_info->qiyong==2){ -// continue; -// } $car_info->location = 2; - $car_info->save(false); + if(!$car_info->save(false)) { + throw new Exception(print_r($car_info->getFirstErrors(),true)); + } $b_info = CarBT::findOne(['id'=>$car_info->id]); if(!$b_info) { $b_info = new CarBT(false); $b_info->id = $car_info->id; $b_info->user_id = 0; - $b_info->save(); + if(!$b_info->save(false)) { + throw new Exception(print_r($b_info->getFirstErrors(),true)); + } } $this->addLog($car_info->id,'从A库分配到B库',1); } @@ -416,11 +389,57 @@ class DatabaseController extends BaseController $tran->commit(); } catch (\Exception $e) { $tran->rollBack(); - echo $e->getMessage(); + $result['msg'] = $e->getMessage(); } } return $result; } + public function actionABAll() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $result = array(); + $result['success'] = false; + $result['msg'] = '操作失败'; + + $data = $this->getAQuery($request); + + $query = $data['query']; +// $query->andWhere('location=1'); + + $tran = CarT::getDb()->beginTransaction(); + try { + foreach($query->each(1000) as $car_info) { + if($car_info->location == 1) { + $car_info->location = 2; + if(!$car_info->save(false)) { + throw new Exception(print_r($car_info->getFirstErrors(),true)); + } + + $b_info = CarBT::findOne(['id'=>$car_info->id]); + if(!$b_info) { + $b_info = new CarBT(false); + $b_info->id = $car_info->id; + $b_info->user_id = 0; + if(!$b_info->save(false)) { + throw new Exception(print_r($b_info->getFirstErrors(),true)); + } + } + $this->addLog($car_info->id,'从A库分配到B库',1); + } + } + + $result['success'] = true; + $result['msg'] = '操作成功'; + + $tran->commit(); + } catch (\Exception $e) { + $tran->rollBack(); + $result['msg'] = $e->getMessage(); + } + return $result; + } + public function actionAClean() { Yii::$app->response->format = Response::FORMAT_JSON; @@ -627,8 +646,8 @@ class DatabaseController extends BaseController $result['msg'] = '操作失败'; if($request->isPost) { - $ids = $request->post('ids',array()); - if(count($ids) == 0) { + $ids = explode(',', $request->post('ids')); + if (count($ids) == 0) { $result['msg'] = '请先钩选车辆'; return $result; } @@ -638,18 +657,19 @@ class DatabaseController extends BaseController foreach($ids as $id) { $car_info = CarT::findOne(['id'=>$id]); if($car_info->location == 1) { - if($car_info->qiyong==2){ - continue; - } $car_info->location = 3; - $car_info->save(); + if(!$car_info->save(false)) { + throw new Exception(print_r($car_info->getFirstErrors(),true)); + } $c_info = CarCT::findOne(['id'=>$car_info->id]); if(!$c_info) { - $c_info = new CarCT(); + $c_info = new CarCT(false); $c_info->id = $car_info->id; $c_info->user_id = 0; - $c_info->save(); + if(!$c_info->save(false)) { + throw new Exception(print_r($c_info->getFirstErrors(),true)); + } } $this->addLog($car_info->id,'从A库分配到C库',1); } @@ -661,10 +681,11 @@ class DatabaseController extends BaseController $tran->commit(); } catch (\Exception $e) { $tran->rollBack(); - echo $e->getMessage(); + $result['msg'] = $e->getMessage(); } + + return $result; } - return $result; } diff --git a/frontend/controllers/FinanceController.php b/frontend/controllers/FinanceController.php index f6dc305..a9884af 100644 --- a/frontend/controllers/FinanceController.php +++ b/frontend/controllers/FinanceController.php @@ -43,16 +43,16 @@ use common\models\GiftType2T; use common\models\SendLogT; use common\models\UserT; use common\models\WorkDayT; +use common\models\ZhongjiYingxiao; use Yii; use yii\data\Pagination; use yii\web\Response; use yii\web\UploadedFile; - - class FinanceController extends \frontend\controllers\UserBaseController { public $enableCsrfValidation = false; + public $layout = 'blue-main'; public function actionReceipt() { @@ -3449,8 +3449,6 @@ class FinanceController extends \frontend\controllers\UserBaseController return $result; } - - public function actionImports1() { // set_time_limit(0); @@ -3616,11 +3614,6 @@ class FinanceController extends \frontend\controllers\UserBaseController } - - - - - public function actionReceiptInfo() { $request = Yii::$app->request; @@ -4006,147 +3999,6 @@ class FinanceController extends \frontend\controllers\UserBaseController // 'sum_total' => $sum_total, ]); } -// public function actionReceipt2() -// { -// $request = Yii::$app->request; -// $page = $request->get('page', 1); -// $begin_date = $request->get('begin_date'); -// $end_date = $request->get('end_date'); -// $r_begin_date = $request->get('r_begin_date'); -// $r_end_date = $request->get('r_end_date'); -// $car_no = $request->get('car_no'); -// $insurer_no = $request->get('insurer_no'); -// $status = $request->get('status'); -// $sort_key = $request->get('sort_key'); -// $sort_value = $request->get('sort_value'); -// if ($page < 1) $page = 1; -// -//// $query = OrderCaiwuT::find() -//// ->where('budian_rate>0'); -// $query = CaiwuT::find() -// ->leftJoin(OrderCaiwuT::tableName(), "order_caiwu_t.order_id=caiwu_t.order_id") -// ->leftJoin(OrderT::tableName(), "order_caiwu_t.order_id=order_t.id") -// ->where('order_caiwu_t.budian_rate > 0'); -//// ->orderBy('order_t.print_date DESC'); -// -//// switch ($sort_key) { -//// case 'total': -//// $sort = 'caiwu_t.total '; -//// break; -//// case 'total_clear': -//// $sort = 'caiwu_t.total_clear '; -//// break; -//// case 'total_rate': -//// $sort = 'caiwu_t.total_rate '; -//// break; -//// case 'print_date'://默认按照print_date排序 -//// default: -//// $sort = 'order_t.print_date '; -//// break; -//// } -// -//// switch ($sort_value) { -//// case 'ASC': -//// $sort .= 'ASC'; -//// break; -//// case 'DESC': -//// default: -//// $sort .= 'DESC'; -//// break; -//// } -// -//// $query = $query->orderBy($sort); -// -// if ($car_no != "") { -// $query = $query->andWhere('caiwu_t.car_no like "' . $car_no . '%"'); -// } -// if ($insurer_no != "") { -// $query = $query->andWhere('caiwu_t.insurer_no like "' . $insurer_no . '%"'); -// } -// if ($status > 0) { -// if ($status == 1) { -// $query = $query->andWhere('r_date=""'); -// } -// if ($status == 2) { -// $query = $query->andWhere('r_date<>""'); -// } -// } -// if ($begin_date != "") { -// $query = $query->andWhere('order_t.print_date>="' . $begin_date . '"'); -// } -// if ($end_date != "") { -// $query = $query->andWhere('order_t.print_date<="' . $end_date . '"'); -// } -// if ($r_begin_date != "") { -// $query = $query->andWhere('caiwu_t.r_date>="' . $r_begin_date . '"'); -// } -// if ($r_end_date != "") { -// $query = $query->andWhere('caiwu_t.r_date<="' . $r_end_date . '"'); -// } -//// echo $query->createCommand()->rawSql; -// $total = $query->count(); -// $allitems = $query->all(); -// //商业净保费综合 -// -// -// $yd=0; -// $bd1=0; -// $bd2=0; -// $yh=0; -// $wh=0; -// foreach ($allitems as $item) { -// $order = $item->order; -// $caiwu = $order->caiwu; -// $yd += round($item->total_clear * $caiwu->budian_rate/100,2); -// $bd1+= $item->b1_total; -// $bd2+= $item->b2_total; -// $yh+= $item->b1_total+$item->b2_total+$item->b3_total; -// $wh+= round($item->total_clear * $caiwu->budian_rate/100,2)-($item->b1_total+$item->b2_total+$item->b3_total); -// -// -// } -// -// -// -// $pagination = new Pagination(['totalCount' => $total, 'pageSize' => 20]); -// $pagination->setPage($page - 1); -// -// $query = $query->offset($pagination->offset)->limit($pagination->limit); -// $items = $query->all(); -// -//// $sum_r_total = $query->sum('r_total'); -// -// -// //商业总保费 -//// $sum_total = $query->sum('total'); -// -// $page_info = MyLib::getPageInfo($pagination); -// -// return $this->render('receipt2', [ -// 'items' => $items, -// 'page' => $page, -// 'car_no' => $car_no, -// 'insurer_no' => $insurer_no, -// 'status' => $status, -// 'begin_date' => $begin_date, -// 'end_date' => $end_date, -// 'r_begin_date' => $r_begin_date, -// 'r_end_date' => $r_end_date, -// 'page_info' => $page_info, -// 'sort_key' => $sort_key, -// 'sort_value' => $sort_value, -// 'yd' => $yd, -// 'bd1' => $bd1, -// 'bd2' => $bd2, -// 'yh' => $yh, -// 'wh' => $wh -// -// -//// 'sum_r_total' => $sum_r_total, -//// 'sum_total_clear' => $sum_total_clear, -//// 'sum_total' => $sum_total, -// ]); -// } public function actionReceipt2Output() { $request = Yii::$app->request; @@ -5352,87 +5204,6 @@ class FinanceController extends \frontend\controllers\UserBaseController * 财务工资-详情 * @return string */ -// public function actionPay2Info() -// { -// $request = Yii::$app->request; -// $user_id = $request->get('id', 0); -// $pay_date = $request->get('pay_date', date('Y-m')); -// $back_params = $request->get('back_params'); -// -// $user_info = UserT::findOne(['id' => $user_id]); -// $group_info = $user_info->group; -// -// $work_day = WorkDayT::findOne(['date' => $pay_date]); -// -// if (!$work_day) { -// echo $pay_date . '还没有开始统计'; -// echo "[返回]"; -// die; -// } -// -// $pay_info = PayT::findOne(['user_id' => $user_id, 'pay_date' => $pay_date]); -// if (!$pay_info) { -// $pay_info = new PayT(); -// $pay_info->user_id = $user_id; -// $pay_info->pay_date = $pay_date; -// if ($group_info) { -// $pay_info->should_pay = $group_info->base_pay + $group_info->job_pay + $group_info->station_pay + $user_info->ext_pay; -// } else { -// $pay_info->should_pay = $user_info->ext_pay; -// } -// if (!$pay_info->save()) { -// var_dump($pay_info->errors); -// exit; -// } -// } -// //内勤 -// //核保 -// $my_type5_query = PayOrderUserT::find() -// ->where('pay_date="' . $pay_date . '" and is_own=0 and type=5 and user_id=' . $user_id) -// ->orderBy('created_at asc'); -//// echo $my_type5_query->createCommand()->rawSql; -// //正本 -// $my_type6_query = PayOrderUserT::find() -// ->where('pay_date="' . $pay_date . '" and is_own=0 and type=6 and user_id=' . $user_id) -// ->orderBy('created_at asc'); -// -// -// $my_type1_query = PayOrderUserT::find() -// ->where('pay_date="' . $pay_date . '" and is_own=1 and type=1 and user_id=' . $user_id) -// ->orderBy('created_at asc'); -//// echo $my_type1_query->createCommand()->rawSql; -// $my_type3_query = PayOrderUserT::find() -// ->where('pay_date="' . $pay_date . '" and is_own=1 and type=3 and user_id=' . $user_id) -// ->orderBy('created_at asc'); -//// echo $my_type3_query->createCommand()->rawSql; -// $type_query = PayOrderUserT::find() -// ->where('pay_date="' . $pay_date . '" and type<>4 and type<>5 and type<>6 and is_own=0 and user_id=' . $user_id) -// ->andWhere('should_pay>0') -// ->orderBy('created_at asc'); -//// echo $type_query->createCommand()->rawSql; -// $type3_query = PayOrderUserT::find() -// ->where('pay_date="' . $pay_date . '" and type=4 and user_id=' . $user_id) -// ->orderBy('created_at asc'); -// $pay_order_users = OrderT::find() -// ->where('print_date like "' . $pay_date . '-%"') -// ->andWhere('user_id=' . $this->my->id) -// ->orderBy('updated_at ASC'); -// -// return $this->render('pay2-info', [ -// 'pay_date' => $pay_date, -// 'user_info' => $user_info, -// 'group_info' => $group_info, -// 'pay_info' => $pay_info, -// 'my_type1_query' => $my_type1_query, -// 'my_type3_query' => $my_type3_query, -// 'my_type5_query' => $my_type5_query, -// 'my_type6_query' => $my_type6_query, -// 'type_query' => $type_query, -// 'type3_query' => $type3_query, -// 'back_params' => $back_params, -// 'pay_order_users' => $pay_order_users -// ]); -// } public function actionPay2Info() { $request = Yii::$app->request; @@ -5533,233 +5304,6 @@ class FinanceController extends \frontend\controllers\UserBaseController * @throws \Exception * @throws \yii\db\Exception */ -// public function actionPay2Save() -// { -// Yii::$app->response->format = Response::FORMAT_JSON; -// $request = Yii::$app->request; -// $result = array(); -// $result['success'] = false; -// $result['msg'] = '保存失败'; -// -// $pay_id = $request->post('id', 0); -// $my_rate1 = $request->post('my_rate1', array()); -// $my_rate2 = $request->post('my_rate2', array()); -// $tc_my_payids_1 = $request->post('tc_my_payids_1', array()); -// $tc_my_payids_2 = $request->post('tc_my_payids_2', array()); -// $my_should_pays1 = $request->post('my_should_pays1', array()); -// $my_should_pays2 = $request->post('my_should_pays2', array()); -// $my_real_pays1 = $request->post('my_real_pays1', array()); -// $my_real_pays2 = $request->post('my_real_pays2', array()); -// $tc_payids_1 = $request->post('tc_payids_1', array()); -// $tc_payids_2 = $request->post('tc_payids_2', array()); -// $rate1 = $request->post('rate1', array()); -// $rate2 = $request->post('rate2', array()); -// $should_pays1 = $request->post('should_pays1', array()); -// $should_pays2 = $request->post('should_pays2', array()); -// $real_pays1 = $request->post('real_pays1', array()); -// $real_pays2 = $request->post('real_pays2', array()); -// $tc_send_payids = $request->post('tc_send_payids', array()); -// $send_moneys = $request->post('send_moneys', array()); -// -// //内勤核保 -// $neqi_payids = $request->post('neqi_payids', array()); -// $should_pays5 = $request->post('should_pays5', array()); -// $rate5 = $request->post('rate5', array()); -//// var_dump($rate5); -//// -//// var_dump($should_pays5); -//// die; -//// echo '
'; -// //内勤正本 -// $zhengben = $request->post('zhengben', array()); -// $should_pays6 = $request->post('should_pays6', array()); -// $rate6 = $request->post('rate6', array()); -//// var_dump($zhengben); -//// var_dump($should_pays6); -//// die; -// -// -// -// $calls = $request->post('calls', 0); -// $bus = $request->post('bus', 0); -// $bonus = $request->post('bonus', 0); -// $turnover = $request->post('turnover', 0); -// $driver_num = $request->post('driver_num', 0); -// $driver_price = $request->post('driver_price', 0); -// $fix_total = $request->post('fix_total', 0); -// $fix_rate = $request->post('fix_rate', 0); -// $tax = $request->post('tax', 0); -// -// $pay_info = PayT::findOne(['id' => $pay_id]); -// if ($pay_info) { -// $tran = PayT::getDb()->beginTransaction(); -// try { -// //保存我的新保 -// foreach ($tc_my_payids_1 as $index => $id) { -// $rate = $my_rate1[$index]; -// $pay_order = PayOrderUserT::findOne(['id' => $id]); -// if (!$pay_order) { -// $result['msg'] = '我的新保错误:' . $id . '=>' . $rate; -// return $result; -// } -// $order_info = $pay_order->order; -// $caiwu_info = $order_info->caiwu; -// if ($caiwu_info) { -// $caiwu_info->rate1 = $rate; -// $caiwu_info->money1 = $my_should_pays1[$index]; -// $caiwu_info->save(); -// } -// $pay_order->should_pay = $my_should_pays1[$index]; -// $pay_order->real_pay = $my_real_pays1[$index]; -// $pay_order->save(); -// } -// //我的续保 -// foreach ($tc_my_payids_2 as $index => $id) { -// $rate = $my_rate2[$index]; -// $pay_order = PayOrderUserT::findOne(['id' => $id]); -// if (!$pay_order) { -// $result['msg'] = '我的续保错误:' . $id . '=>' . $rate; -// return $result; -// } -// $order_info = $pay_order->order; -// $caiwu_info = $order_info->caiwu; -// if ($caiwu_info) { -// $caiwu_info->rate3 = $rate; -// $caiwu_info->money3 = $my_should_pays2[$index]; -// $caiwu_info->save(); -// } -// $pay_order->should_pay = $my_should_pays2[$index]; -// $pay_order->real_pay = $my_real_pays2[$index]; -// $pay_order->save(); -// } -// //我的提成 -// foreach ($tc_payids_1 as $index => $id) { -// $pay_order = PayOrderUserT::findOne(['id' => $id]); -// if (!$pay_order) { -// $result['msg'] = '我的提成错误1:' . $id . '=>' . $rate1[$index]; -// return $result; -// } -// $order_info = $pay_order->order; -// $caiwu_info = $order_info->caiwu; -// if ($caiwu_info) { -// $caiwu_info->rate1 = $rate1[$index]; -// $caiwu_info->money1 = $should_pays1[$index]; -// $caiwu_info->save(); -// } -// $pay_order->should_pay = $should_pays1[$index]; -// $pay_order->real_pay = $real_pays1[$index]; -// $pay_order->save(); -// } -// foreach ($tc_payids_2 as $index => $id) { -// $pay_order = PayOrderUserT::findOne(['id' => $id]); -// if (!$pay_order) { -// $result['msg'] = '我的提成错误2:' . $id . '=>' . $rate2[$index]; -// return $result; -// } -// $order_info = $pay_order->order; -// $caiwu_info = $order_info->caiwu; -// if ($caiwu_info) { -// $caiwu_info->rate2 = $rate2[$index]; -// $caiwu_info->money2 = $should_pays2[$index]; -// $caiwu_info->save(); -// } -// $pay_order->should_pay = $should_pays2[$index]; -// $pay_order->real_pay = $real_pays2[$index]; -// $pay_order->save(); -// } -// //送单提成 -// foreach ($tc_send_payids as $index => $id) { -// $send_money = $send_moneys[$index]; -// $pay_order = PayOrderUserT::findOne(['id' => $id]); -// if (!$pay_order) { -// $result['msg'] = '送单提成错误:' . $id . '=>' . $send_money; -// return $result; -// } -// $order_info = $pay_order->order; -// $caiwu_info = $order_info->caiwu; -// if ($caiwu_info) { -// if ($order_info->total1_clear == 0) { -// $caiwu_info->send_rate = 0; -// } else { -// $caiwu_info->send_rate = round($send_money / $order_info->total1_clear * 100, 2); -// } -// $caiwu_info->send_money = $send_money; -// $caiwu_info->save(); -// } -// $pay_order->should_pay = $send_money; -// $pay_order->real_pay = $send_money; -// $pay_order->save(); -// } -// -// //核保 -// foreach ($neqi_payids as $index => $id) { -// $pay_order = PayOrderUserT::findOne(['id' => $id]); -// if (!$pay_order) { -// $result['msg'] = '我的提成错误2:' . $id . '=>' . $rate5[$index]; -// return $result; -// } -// $order_info = $pay_order->order; -// $caiwu_info = $order_info->caiwu; -// if ($caiwu_info) { -// if(!isset($rate5[$index])) continue; -// $caiwu_info->rate4 = $rate5[$index]; -// $caiwu_info->money4 = $should_pays5[$index]; -// $caiwu_info->save(); -// } -// $pay_order->should_pay = $should_pays5[$index]; -// $pay_order->real_pay = $should_pays5[$index]; -// $pay_order->save(); -// } -// //正本$neqi_payids1 -// foreach ($zhengben as $index => $id) { -// $pay_order = PayOrderUserT::findOne(['id' => $id]); -// if (!$pay_order) { -// $result['msg'] = '我的提成错误2:' . $id . '=>' . $rate6[$index]; -// return $result; -// } -// $order_info = $pay_order->order; -// $caiwu_info = $order_info->caiwu; -// if ($caiwu_info) { -// if(!isset($rate6[$index])) continue; -// $caiwu_info->rate5 = $rate6[$index]; -// $caiwu_info->money5 = $should_pays6[$index]; -// $caiwu_info->save(); -// } -// $pay_order->should_pay = $should_pays6[$index]; -// $pay_order->real_pay = $should_pays6[$index]; -// $pay_order->save(); -// } -// -// -// -// -// $pay_info->calls = $calls; -// $pay_info->bus = $bus; -// $pay_info->bonus = $bonus; -// $pay_info->turnover = $turnover; -// $pay_info->driver_num = $driver_num; -// $pay_info->driver_price = $driver_price; -// $pay_info->fix_total = $fix_total; -// $pay_info->fix_rate = $fix_rate; -// $pay_info->tax = $tax; -// $pay_info->save(); -// $pay_info->calPay(); -//// $pay_info->save(); -// -// $content = $this->my->showName . '修改' . $pay_info->pay_date . '工资'; -// $this->addUserLog($pay_info->user_id, $content); -// -// $tran->commit(); -// } catch (\Exception $e) { -// $tran->rollBack(); -// throw $e; -// } -// -// $result['success'] = true; -// $result['msg'] = '保存成功'; -// } -// return $result; -// } public function actionPay2Save() { Yii::$app->response->format = Response::FORMAT_JSON; @@ -6815,7 +6359,6 @@ class FinanceController extends \frontend\controllers\UserBaseController } - public function actionCarUpdateFrame() { return $this->render('car-update-frame', []); diff --git a/frontend/controllers/GiftController.php b/frontend/controllers/GiftController.php index e4631af..28aae4d 100644 --- a/frontend/controllers/GiftController.php +++ b/frontend/controllers/GiftController.php @@ -6,6 +6,7 @@ use common\libs\MyLib; use common\models\CarGiftT; use common\models\EmsT; use common\models\GiftT; +use common\models\GiftTicketTUse; use common\models\GiftTypeT; use common\models\GroupT; use common\models\InsurerTypeT; @@ -19,6 +20,9 @@ use yii\web\Response; class GiftController extends \yii\web\Controller { public $my = null; + public $enableCsrfValidation = false; + public $layout = 'blue-main'; + private $_outEncoding = "GB2312"; public function init() { @@ -38,19 +42,43 @@ class GiftController extends \yii\web\Controller public function actionIndex() { + return $this->render('index'); + } + + public function actionIndexJson() + { + Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; + $type_id = $request->get('type_id'); $name = $request->get('name'); - $query = GiftT::find(); + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); + + $query = GiftT::find() + ->where('is_delete=0'); + if($type_id > 0) { + $query = $query->andWhere('typeid='.$type_id); + } if($name != '') { - $query = $query->andWhere(['like','name',$name]); + $query = $query->andWhere('name like "'.$name.'"'); } + $query = $query->orderBy('id desc'); + $total = $query->count(); + + $query = $query->offset($offset)->limit($limit); $items = $query->all(); - return $this->render('index',[ - 'items' => $items, - 'name' => $name - ]); + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $row['type'] = $item->getShowType(); + $data['rows'][] = $row; + } + + return $data; } public function actionEdit() @@ -63,12 +91,8 @@ class GiftController extends \yii\web\Controller $info = new GiftT(); } - $type_items = GiftTypeT::find() - ->all(); - return $this->render('edit',[ - 'info' => $info, - 'type_items' => $type_items + 'info' => $info ]); } @@ -84,16 +108,19 @@ class GiftController extends \yii\web\Controller $id = $request->post('id',0); $type_id = $request->post('type_id'); $name = $request->post('name'); + $img = $request->post('img'); $price = $request->post('price'); $remark = $request->post('remark'); $total = (int)$request->post('total'); - $total_lock = (int)$request->post('total_lock'); + $use_num = (int)$request->post('use_num'); if($name == '') { $result['msg'] = '请输入名称!'; return $result; } + $pin_name=trim($this->getPinyin($name),' '); + $row = null; if($id > 0) { $row = GiftT::findOne(['id'=>$id]); @@ -103,9 +130,11 @@ class GiftController extends \yii\web\Controller $row->type_id = $type_id; $row->name = $name; $row->price = $price; + $row->original_img = $img; $row->remark = $remark; $row->total = $total; - $row->total_lock = $total_lock; + $row->use_num = $use_num; + $row->pinyin_name = $pin_name; $row->save(); $result['success'] = true; @@ -127,8 +156,8 @@ class GiftController extends \yii\web\Controller if($id > 0) { $row = GiftT::findOne(['id'=>$id]); - $row->unlinkAll('strategys',true); - $row->delete(); + $row->is_delete = 1; + $row->save(); $result['success'] = true; $result['msg'] = '删除成功'; @@ -506,4 +535,437 @@ class GiftController extends \yii\web\Controller } return $result; } + public function getPinyin($str,$pix=' ',$code = 'gb2312'){ + $_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha" . "|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chui|chun|chuo|ci|cong|cou|cu|" . "cuan|cui|cun|cuo|da|dai|dan|dang|dao|de|deng|di|dian|diao|die|ding|diu|dong|dou|du|duan|dui|dun|duo|e|en|er" . "|fa|fan|fang|fei|fen|feng|fo|fou|fu|ga|gai|gan|gang|gao|ge|gei|gen|geng|gong|gou|gu|gua|guai|guan|guang|gui" . "|gun|guo|ha|hai|han|hang|hao|he|hei|hen|heng|hong|hou|hu|hua|huai|huan|huang|hui|hun|huo|ji|jia|jian|jiang" . "|jiao|jie|jin|jing|jiong|jiu|ju|juan|jue|jun|ka|kai|kan|kang|kao|ke|ken|keng|kong|kou|ku|kua|kuai|kuan|kuang" . "|kui|kun|kuo|la|lai|lan|lang|lao|le|lei|leng|li|lia|lian|liang|liao|lie|lin|ling|liu|long|lou|lu|lv|luan|lue" . "|lun|luo|ma|mai|man|mang|mao|me|mei|men|meng|mi|mian|miao|mie|min|ming|miu|mo|mou|mu|na|nai|nan|nang|nao|ne" . "|nei|nen|neng|ni|nian|niang|niao|nie|nin|ning|niu|nong|nu|nv|nuan|nue|nuo|o|ou|pa|pai|pan|pang|pao|pei|pen" . "|peng|pi|pian|piao|pie|pin|ping|po|pu|qi|qia|qian|qiang|qiao|qie|qin|qing|qiong|qiu|qu|quan|que|qun|ran|rang" . "|rao|re|ren|reng|ri|rong|rou|ru|ruan|rui|run|ruo|sa|sai|san|sang|sao|se|sen|seng|sha|shai|shan|shang|shao|" . "she|shen|sheng|shi|shou|shu|shua|shuai|shuan|shuang|shui|shun|shuo|si|song|sou|su|suan|sui|sun|suo|ta|tai|" . "tan|tang|tao|te|teng|ti|tian|tiao|tie|ting|tong|tou|tu|tuan|tui|tun|tuo|wa|wai|wan|wang|wei|wen|weng|wo|wu" . "|xi|xia|xian|xiang|xiao|xie|xin|xing|xiong|xiu|xu|xuan|xue|xun|ya|yan|yang|yao|ye|yi|yin|ying|yo|yong|you" . "|yu|yuan|yue|yun|za|zai|zan|zang|zao|ze|zei|zen|zeng|zha|zhai|zhan|zhang|zhao|zhe|zhen|zheng|zhi|zhong|" . "zhou|zhu|zhua|zhuai|zhuan|zhuang|zhui|zhun|zhuo|zi|zong|zou|zu|zuan|zui|zun|zuo"; + $_DataValue = "-20319|-20317|-20304|-20295|-20292|-20283|-20265|-20257|-20242|-20230|-20051|-20036|-20032|-20026|-20002|-19990" . "|-19986|-19982|-19976|-19805|-19784|-19775|-19774|-19763|-19756|-19751|-19746|-19741|-19739|-19728|-19725" . "|-19715|-19540|-19531|-19525|-19515|-19500|-19484|-19479|-19467|-19289|-19288|-19281|-19275|-19270|-19263" . "|-19261|-19249|-19243|-19242|-19238|-19235|-19227|-19224|-19218|-19212|-19038|-19023|-19018|-19006|-19003" . "|-18996|-18977|-18961|-18952|-18783|-18774|-18773|-18763|-18756|-18741|-18735|-18731|-18722|-18710|-18697" . "|-18696|-18526|-18518|-18501|-18490|-18478|-18463|-18448|-18447|-18446|-18239|-18237|-18231|-18220|-18211" . "|-18201|-18184|-18183|-18181|-18012|-17997|-17988|-17970|-17964|-17961|-17950|-17947|-17931|-17928|-17922" . "|-17759|-17752|-17733|-17730|-17721|-17703|-17701|-17697|-17692|-17683|-17676|-17496|-17487|-17482|-17468" . "|-17454|-17433|-17427|-17417|-17202|-17185|-16983|-16970|-16942|-16915|-16733|-16708|-16706|-16689|-16664" . "|-16657|-16647|-16474|-16470|-16465|-16459|-16452|-16448|-16433|-16429|-16427|-16423|-16419|-16412|-16407" . "|-16403|-16401|-16393|-16220|-16216|-16212|-16205|-16202|-16187|-16180|-16171|-16169|-16158|-16155|-15959" . "|-15958|-15944|-15933|-15920|-15915|-15903|-15889|-15878|-15707|-15701|-15681|-15667|-15661|-15659|-15652" . "|-15640|-15631|-15625|-15454|-15448|-15436|-15435|-15419|-15416|-15408|-15394|-15385|-15377|-15375|-15369" . "|-15363|-15362|-15183|-15180|-15165|-15158|-15153|-15150|-15149|-15144|-15143|-15141|-15140|-15139|-15128" . "|-15121|-15119|-15117|-15110|-15109|-14941|-14937|-14933|-14930|-14929|-14928|-14926|-14922|-14921|-14914" . "|-14908|-14902|-14894|-14889|-14882|-14873|-14871|-14857|-14678|-14674|-14670|-14668|-14663|-14654|-14645" . "|-14630|-14594|-14429|-14407|-14399|-14384|-14379|-14368|-14355|-14353|-14345|-14170|-14159|-14151|-14149" . "|-14145|-14140|-14137|-14135|-14125|-14123|-14122|-14112|-14109|-14099|-14097|-14094|-14092|-14090|-14087" . "|-14083|-13917|-13914|-13910|-13907|-13906|-13905|-13896|-13894|-13878|-13870|-13859|-13847|-13831|-13658" . "|-13611|-13601|-13406|-13404|-13400|-13398|-13395|-13391|-13387|-13383|-13367|-13359|-13356|-13343|-13340" . "|-13329|-13326|-13318|-13147|-13138|-13120|-13107|-13096|-13095|-13091|-13076|-13068|-13063|-13060|-12888" . "|-12875|-12871|-12860|-12858|-12852|-12849|-12838|-12831|-12829|-12812|-12802|-12607|-12597|-12594|-12585" . "|-12556|-12359|-12346|-12320|-12300|-12120|-12099|-12089|-12074|-12067|-12058|-12039|-11867|-11861|-11847" . "|-11831|-11798|-11781|-11604|-11589|-11536|-11358|-11340|-11339|-11324|-11303|-11097|-11077|-11067|-11055" . "|-11052|-11045|-11041|-11038|-11024|-11020|-11019|-11018|-11014|-10838|-10832|-10815|-10800|-10790|-10780" . "|-10764|-10587|-10544|-10533|-10519|-10331|-10329|-10328|-10322|-10315|-10309|-10307|-10296|-10281|-10274" . "|-10270|-10262|-10260|-10256|-10254"; + $_TDataKey = explode ( '|', $_DataKey ); + $_TDataValue = explode ( '|', $_DataValue ); + $data = (PHP_VERSION >= '5.0') ? array_combine ( $_TDataKey, $_TDataValue ) : $this->_Array_Combine( $_TDataKey, $_TDataValue ); + arsort ( $data ); + reset ( $data ); + $str = $this->safe_encoding ( $str ); + $_Res = ''; + for($i = 0; $i < strlen ( $str ); $i ++) { + $_P = ord ( substr ( $str, $i, 1 ) ); + if ($_P > 160) { + $_Q = ord ( substr ( $str, ++ $i, 1 ) ); + $_P = $_P * 256 + $_Q - 65536; + } + $_Res .= $this->_Pinyin ( $_P, $data ).$pix; + } + return preg_replace ( "/[^a-z0-9".$pix."]*/", '', $_Res ); + } + private function _Pinyin($_Num, $_Data) { + if ($_Num > 0 && $_Num < 160) + return chr ( $_Num ); + elseif ($_Num < - 20319 || $_Num > - 10247) + return ''; + else { + foreach ( $_Data as $k => $v ) { + if ($v <= $_Num) + break; + } + return $k; + } + } + public function getFirstChar($str=''){ + if( !$str ) return null; + $fchar=ord($str{0}); + if($fchar>=ord("A") and $fchar<=ord("z") )return strtoupper($str{0}); + $s= $this->safe_encoding($str); + $asc=ord($s{0})*256+ord($s{1})-65536; + if($asc>=-20319 and $asc<=-20284)return "A"; + if($asc>=-20283 and $asc<=-19776)return "B"; + if($asc>=-19775 and $asc<=-19219)return "C"; + if($asc>=-19218 and $asc<=-18711)return "D"; + if($asc>=-18710 and $asc<=-18527)return "E"; + if($asc>=-18526 and $asc<=-18240)return "F"; + if($asc>=-18239 and $asc<=-17923)return "G"; + if($asc>=-17922 and $asc<=-17418)return "H"; + if($asc>=-17417 and $asc<=-16475)return "J"; + if($asc>=-16474 and $asc<=-16213)return "K"; + if($asc>=-16212 and $asc<=-15641)return "L"; + if($asc>=-15640 and $asc<=-15166)return "M"; + if($asc>=-15165 and $asc<=-14923)return "N"; + if($asc>=-14922 and $asc<=-14915)return "O"; + if($asc>=-14914 and $asc<=-14631)return "P"; + if($asc>=-14630 and $asc<=-14150)return "Q"; + if($asc>=-14149 and $asc<=-14091)return "R"; + if($asc>=-14090 and $asc<=-13319)return "S"; + if($asc>=-13318 and $asc<=-12839)return "T"; + if($asc>=-12838 and $asc<=-12557)return "W"; + if($asc>=-12556 and $asc<=-11848)return "X"; + if($asc>=-11847 and $asc<=-11056)return "Y"; + if($asc>=-11055 and $asc<=-10247)return "Z"; + return null; + } + function safe_encoding($string) { + $encoding="UTF-8"; + for($i=0;$i_outEncoding)) + + return $string; + else + return iconv($encoding,$this->_outEncoding,$string); + } + private function _Array_Combine($_Arr1, $_Arr2){ + $_Res=array(); + for($i = 0; $i < count ( $_Arr1 ); $i ++) + $_Res [$_Arr1 [$i]] = $_Arr2 [$i]; + return $_Res; + } + + public function actionStastics() { + return $this->render('stastics'); + } + + public function actionStasticsJson() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); + + $query = GiftT::find() + ->where('is_delete=0'); + $query = $query->orderBy('id desc'); + $total = $query->count(); + + $query = $query->offset($offset)->limit($limit); + $items = $query->all(); + + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $row['total'] = $item->getTicketsUse()->count(); + $type_id = $item->type_id; + if($type_id ==1){//礼品 + $row['out_total'] = $item->getTicketsUse()->where('status=3')->count(); + $row['use_total'] = $item->getTicketsUse()->where('status=3')->count(); + }elseif ($type_id==2){ + $row['out_total'] = $item->getTicketsUse()->count(); + $row['use_total'] = $item->getTicketsUse()->where('status>1')->count(); + } + $data['rows'][] = $row; + } + + return $data; + } + + public function actionGiftOut() { + $type_items = GiftT::find() + ->where(['type_id'=>1,'is_delete'=>0]) + ->all(); + return $this->render('gift-out', [ + 'type_items' => $type_items + ]); + } + + public function actionGiftOutJson() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $code = $request->get('code'); + $car_no = $request->get('car_no'); + $username = $request->get('username'); + $s_begin_date = $request->get('s_begin_date'); + $s_end_date = $request->get('s_end_date'); + $p_begin_date = $request->get('p_begin_date'); + $p_end_date = $request->get('p_end_date'); + $status = $request->get('status'); + $frame_no = $request->get('frame_no'); + $engine_no = $request->get('engine_no'); + $insurer1_no = $request->get('insurer1_no'); + $type_id = $request->get('type_id'); + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); + + $query = GiftTicketTUse::find() + ->leftJoin('order_t','order_t.id=gift_ticket_t_use.order_id') + ->leftJoin('gift_t','gift_t.id=gift_ticket_t_use.type_id') + ->leftJoin('user_t','user_t.id=gift_ticket_t_use.user_id') + ->where('gift_t.type_id=1') + ->orderBy('id DESC'); + if($code != '') { + $query = $query->andWhere('gift_ticket_t_use.code="'.$code.'"'); + } + if($car_no != '') { + $query = $query->andWhere('gift_ticket_t_use.car_no like "'.$car_no.'"'); + } + + if($username != ''){ + $user = UserT::find()->where('username="'.$username.'"')->andWhere('is_delete=0')->one(); + $query = $query->andWhere('gift_ticket_t_use.op_id='.$user->id); + } + + if($s_begin_date != ''){ + $query = $query->andWhere('order_t.submit_date>="'.$s_begin_date.'"'); + } + if($s_end_date != ''){ + $query = $query->andWhere('order_t.submit_date<="'.$s_begin_date.'"'); + } + if($p_begin_date != ''){ + $query = $query->andWhere('order_t.print_date>="'.$p_begin_date.'"'); + } + if($p_end_date != ''){ + $query = $query->andWhere('order_t.print_date<="'.$p_begin_date.'"'); + } + + if ($status == 1) {//礼券未使用 + $query = $query->andWhere('gift_t.type_id=2 and gift_ticket_t_use.status=1'); + } elseif ($status == 2) {//礼券使用中 + $query = $query->andWhere('gift_t.type_id=2 and gift_ticket_t_use.status=2'); + } + if ($status == 3) {//礼券使用完 + $query = $query->andWhere('gift_t.type_id=2 and gift_ticket_t_use.status=3'); + } + if ($status == 4) {//礼品未出库 + $query = $query->andWhere('gift_t.type_id=1 and gift_ticket_t_use.status=1'); + } + if ($status == 5) {//礼品已出库 + $query = $query->andWhere('gift_t.type_id=1 and gift_ticket_t_use.status=3'); + } + + if($frame_no != '') { + $query = $query->andWhere('order_t.car_frame_no="'.$frame_no.'"'); + } + if($engine_no != '') { + $query = $query->andWhere('order_t.engine_no="'.$engine_no.'"'); + } + if($insurer1_no != '') { + $query = $query->andWhere('order_t.insurer1_no='.$insurer1_no); + } + if($type_id > 0) { + $query = $query->andWhere('gift_ticket_t_use.type_id='.$type_id); + } + +// echo $query->createCommand()->rawSql; + $total = $query->count(); + $items = $query->offset($offset)->limit($limit)->all(); + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $order_info = $item->order; + $gift_info = $item->typeNew; + + $row = $item->toArray(); + $row['name'] = $gift_info->name; + $row['car_no'] = $item->car_no; + $row['car_frame_no'] = $order_info->car_no; + $row['op'] = $item->op?$item->op->getShowName():''; + $row['finished_date'] = $item->finished_date != '0000-00-00'?$item->finished_date:''; + $row['user'] = ($item->user && $item->status > 0)?$item->user->getShowName():''; + $row['status'] = $item->getStatus(); + $row['use_num'] = $gift_info->use_num; + $data['rows'][] = $row; + } + + return $data; + } + + public function actionGiftUse() { + $type_items = GiftT::find() + ->where(['type_id'=>2,'is_delete'=>0]) + ->all(); + return $this->render('gift-use', [ + 'type_items' => $type_items + ]); + } + + public function actionGiftUseJson() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $code = $request->get('code'); + $car_no = $request->get('car_no'); + $username = $request->get('username'); + $s_begin_date = $request->get('s_begin_date'); + $s_end_date = $request->get('s_end_date'); + $p_begin_date = $request->get('p_begin_date'); + $p_end_date = $request->get('p_end_date'); + $status = $request->get('status'); + $frame_no = $request->get('frame_no'); + $engine_no = $request->get('engine_no'); + $insurer1_no = $request->get('insurer1_no'); + $type_id = $request->get('type_id'); + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); + + $query = GiftTicketTUse::find() + ->leftJoin('order_t','order_t.id=gift_ticket_t_use.order_id') + ->leftJoin('gift_t','gift_t.id=gift_ticket_t_use.type_id') + ->leftJoin('user_t','user_t.id=gift_ticket_t_use.user_id') + ->where('gift_t.type_id=2') + ->orderBy('id DESC'); + if($code != '') { + $query = $query->andWhere('gift_ticket_t_use.code="'.$code.'"'); + } + if($car_no != '') { + $query = $query->andWhere('gift_ticket_t_use.car_no like "'.$car_no.'"'); + } + + if($username != ''){ + $user = UserT::find()->where('username="'.$username.'"')->andWhere('is_delete=0')->one(); + $query = $query->andWhere('gift_ticket_t_use.op_id='.$user->id); + } + + if($s_begin_date != ''){ + $query = $query->andWhere('order_t.submit_date>="'.$s_begin_date.'"'); + } + if($s_end_date != ''){ + $query = $query->andWhere('order_t.submit_date<="'.$s_begin_date.'"'); + } + if($p_begin_date != ''){ + $query = $query->andWhere('order_t.print_date>="'.$p_begin_date.'"'); + } + if($p_end_date != ''){ + $query = $query->andWhere('order_t.print_date<="'.$p_begin_date.'"'); + } + + if ($status == 1) {//礼券未使用 + $query = $query->andWhere('gift_t.type_id=2 and gift_ticket_t_use.status=1'); + } elseif ($status == 2) {//礼券使用中 + $query = $query->andWhere('gift_t.type_id=2 and gift_ticket_t_use.status=2'); + } + if ($status == 3) {//礼券使用完 + $query = $query->andWhere('gift_t.type_id=2 and gift_ticket_t_use.status=3'); + } + if ($status == 4) {//礼品未出库 + $query = $query->andWhere('gift_t.type_id=1 and gift_ticket_t_use.status=1'); + } + if ($status == 5) {//礼品已出库 + $query = $query->andWhere('gift_t.type_id=1 and gift_ticket_t_use.status=3'); + } + + if($frame_no != '') { + $query = $query->andWhere('order_t.car_frame_no="'.$frame_no.'"'); + } + if($engine_no != '') { + $query = $query->andWhere('order_t.engine_no="'.$engine_no.'"'); + } + if($insurer1_no != '') { + $query = $query->andWhere('order_t.insurer1_no='.$insurer1_no); + } + if($type_id > 0) { + $query = $query->andWhere('gift_ticket_t_use.type_id='.$type_id); + } + +// echo $query->createCommand()->rawSql; + $total = $query->count(); + $items = $query->offset($offset)->limit($limit)->all(); + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $order_info = $item->order; + $gift_info = $item->typeNew; + + $row = $item->toArray(); + $row['name'] = $gift_info->name; + $row['car_no'] = $item->car_no; + $row['car_frame_no'] = $order_info->car_no; + $row['op'] = $item->op?$item->op->getShowName():''; + $row['finished_date'] = $item->finished_date != '0000-00-00'?$item->finished_date:''; + $row['user'] = ($item->user && $item->status > 0)?$item->user->getShowName():''; + $row['status'] = $item->getStatus(); + $row['use_num'] = $gift_info->use_num; + $data['rows'][] = $row; + } + + return $data; + } + + public function actionGiftTj() { + return $this->render('gift-tj'); + } + + public function actionGiftTjJson() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $date_type = $request->get('date_type'); + $begin_date = $request->get('begin_date'); + $end_date = $request->get('end_date'); + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); + + $query = GiftT::find()->where(['type_id'=>1, 'is_delete'=>0]); + +// echo $query->createCommand()->rawSql; + $total = $query->count(); + $items = $query->offset($offset)->limit($limit)->all(); + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $total = $item->getTicketsUseByDate($date_type,$begin_date,$end_date)->count(); + $out_total = $item->getTicketsUseByDate($date_type,$begin_date,$end_date)->andWhere('gift_ticket_t_use.status=3')->count(); + + $row = $item->toArray(); + $row['total'] = $total; + $row['unout_total'] = $total - $out_total; + $row['out_total'] = $out_total; + $data['rows'][] = $row; + } + + return $data; + } + + public function actionTicketTj() { + return $this->render('ticket-tj'); + } + + public function actionTicketTjJson() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $date_type = $request->get('date_type'); + $begin_date = $request->get('begin_date'); + $end_date = $request->get('end_date'); + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); + + $query = GiftT::find()->where(['type_id'=>2, 'is_delete'=>0]); + +// echo $query->createCommand()->rawSql; + $total = $query->count(); + $items = $query->offset($offset)->limit($limit)->all(); + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $total = $item->getTicketsUseByDate($date_type,$begin_date,$end_date)->count(); + $use_total = $item->getTicketsUseByDate($date_type,$begin_date,$end_date)->andWhere('gift_ticket_t_use.status=3')->count(); + + $row = $item->toArray(); + $row['total'] = $total; + $row['unuse_total'] = $total - $use_total; + $row['use_total'] = $use_total; + $data['rows'][] = $row; + } + + return $data; + } } diff --git a/frontend/controllers/MarketingStrategyController.php b/frontend/controllers/MarketingStrategyController.php new file mode 100644 index 0000000..d3b6d8c --- /dev/null +++ b/frontend/controllers/MarketingStrategyController.php @@ -0,0 +1,107 @@ +render('index'); + } + + public function actionIndexJson() { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); + + $query = ZhongjiYingxiao::find() + ->where('is_delete=0') + ->orderBy('id desc'); + + $total = $query->count(); + + $query = $query->offset($offset)->limit($limit); + $items = $query->all(); + + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $data['rows'][] = $row; + } + + return $data; + } + + public function actionAdd() { + return $this->render('add'); + } + + public function actionEdit() { + $request = Yii::$app->request; + $id = $request->get('id'); + $info = ZhongjiYingxiao::findOne(['id'=>$id]); + + return $this->render('edit', [ + 'info' => $info + ]); + } + + public function actionSave() { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $result = array(); + $result['success'] = false; + $result['msg'] = '保存失败'; + + if($request->isPost) { + $op = $request->post('op', 'add'); + $name = $request->post('name'); + $begin_date = $request->post('begin_date'); + $begin_time = $request->post('begin_time'); + $end_date = $request->post('end_date'); + $end_time = $request->post('end_time'); + $remark = $request->post('remark'); + + if($op == 'add') { + $item = new ZhongjiYingxiao(); + $item->celuo_name = $name; + $item->begin_date = $begin_date.' '.$begin_time.':00'; + $item->end_date = $end_date.' '.$end_time.':00'; + $item->is_delete = 0; + $item->remark = $remark; + $item->save(); + + $result['success'] = true; + $result['msg'] = '保存成功'; + return $result; + } else { + $id = $request->post('id'); + $item = ZhongjiYingxiao::findOne(['id'=>$id]); + if($item) { + $item->celuo_name = $name; + $item->begin_date = $begin_date.' '.$begin_time.':00'; + $item->end_date = $end_date.' '.$end_time.':00'; + $item->remark = $remark; + $item->save(); + + $result['success'] = true; + $result['msg'] = '保存成功'; + return $result; + } + } + } + return $result; + + } +} \ No newline at end of file diff --git a/frontend/controllers/UserController.php b/frontend/controllers/UserController.php index c3eb343..d1c905d 100644 --- a/frontend/controllers/UserController.php +++ b/frontend/controllers/UserController.php @@ -16,11 +16,14 @@ use common\models\UserT; use common\models\WorktypeT; use Yii; use yii\data\Pagination; +use yii\web\Request; use yii\web\Response; class UserController extends \frontend\controllers\UserBaseController { public $my = null; + public $enableCsrfValidation = false; + public $layout = 'blue-main'; public function init() { @@ -40,12 +43,22 @@ class UserController extends \frontend\controllers\UserBaseController public function actionIndex() { + $group_items = GroupT::getTree(); + + return $this->render('index',[ + 'group_items' => $group_items + ]); + } + + public function actionIndexJson() { + Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; $username = $request->get('username'); $name = $request->get('name'); $phone = $request->get('phone'); $group_id = $request->get('group_id',0); - $page = $request->get('page',1); + $offset = $request->get('offset',0); + $limit = $request->get('limit', 10); $is_leave = $request->get('is_leave'); $query = UserT::find() @@ -68,27 +81,23 @@ class UserController extends \frontend\controllers\UserBaseController $query = $query->orderBy('username ASC,id ASC'); $total = $query->count(); - $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]); - $pagination->setPage($page-1); - - $query = $query->offset($pagination->offset)->limit($pagination->limit); + $query = $query->offset($offset)->limit($limit); $items = $query->all(); - $page_info = MyLib::getPageInfo($pagination); + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $row['is_login'] = $item->is_login ? '是':''; + $row['group_name'] = $item->group ? $item->group->getPath():''; + $row['role_name'] = $item->role ? $item->role->name : ''; + $row['is_leave'] = $item->is_leave ? '已离职':''; + $data['rows'][] = $row; + } - $group_items = GroupT::getTree(); + return $data; - return $this->render('index',[ - 'group_items' => $group_items, - 'items' => $items, - 'page_info' => $page_info, - 'page' => $page, - 'username' => $username, - 'name' => $name, - 'phone' => $phone, - 'group_id' => $group_id, - 'is_leave' => $is_leave - ]); } public function actionEdit() @@ -101,7 +110,6 @@ class UserController extends \frontend\controllers\UserBaseController } else { $info = new UserT(); $info->is_login = true; - $info->company_id = 0; } $phone_server_items = PhoneServerT::find()->all(); @@ -110,10 +118,6 @@ class UserController extends \frontend\controllers\UserBaseController $permissions = PermissionsT::find() ->all(); $worktypes = WorktypeT::find()->all(); - $business_group = BusinessGroupT::find()->all(); - - $company_items = CompanyT::find()->all(); - $department_items = DepartmentT::getTree($info->company_id); return $this->render('edit',[ 'info' => $info, @@ -122,10 +126,7 @@ class UserController extends \frontend\controllers\UserBaseController 'role_items' => $role_items, 'permissions' => $permissions, 'worktypes' => $worktypes, - 'back_params' => $back_params, - 'business_group' => $business_group, - 'company_items' => $company_items, - 'department_items' => $department_items + 'back_params' => $back_params ]); } @@ -158,10 +159,7 @@ class UserController extends \frontend\controllers\UserBaseController $try_rate = $request->post('try_rate'); $worktype_id = $request->post('worktype_id',0); $is_leave = $request->post('is_leave',0); - $business_group_id = $request->post('business_group_id'); $is_double = $request->post('is_double', 0); - $company_id = $request->post('company_id',0); - $department_id = $request->post('department_id',0); $permissions = $request->post('permissions',array()); $menus = $request->post('menus',array()); @@ -210,9 +208,6 @@ class UserController extends \frontend\controllers\UserBaseController $row->worktype_id = $worktype_id; $row->is_leave = $is_leave; $row->is_double = $is_double; - $row->business_group_id = $business_group_id; - $row->company_id = $company_id; - $row->department_id = $department_id; $row->save(); //处理权限 diff --git a/frontend/views/car/edit.php b/frontend/views/car/edit.php index 50d08f2..578d4c2 100644 --- a/frontend/views/car/edit.php +++ b/frontend/views/car/edit.php @@ -1,343 +1,141 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
车牌号 - - 厂牌型号 - - 发动机号 - -
车主 - - 联系电话 - - 证件号码 - -
年份 - - 车架号 - - 初登日期 - -
车辆类型 - - 运营性质 - - 座位数 - -
品牌 - - 厂家 - - 车型 - -
车系 - - 新保业务员 - - 续保业务员 - -
备注 - -
- -    - -
- - - - + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +beginBlock('footer_js'); ?> +endBlock('footer_js'); ?> diff --git a/frontend/views/common/index.php b/frontend/views/common/index.php index 6be0fdf..0152bac 100644 --- a/frontend/views/common/index.php +++ b/frontend/views/common/index.php @@ -86,7 +86,7 @@ - 退出 + 退出 @@ -95,7 +95,7 @@ diff --git a/frontend/views/database/a-index-search.php b/frontend/views/database/a-index-search.php new file mode 100644 index 0000000..3589d8c --- /dev/null +++ b/frontend/views/database/a-index-search.php @@ -0,0 +1,121 @@ + +beginBlock('header_css'); ?> +endBlock(); ?> + +
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+
+ + + +
+
+ +
+
+ + + +
+
+
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ +
+
+
+
+
+
+ +beginBlock('footer_js'); ?> + +endBlock('footer_js'); ?> diff --git a/frontend/views/database/a-index.php b/frontend/views/database/a-index.php index 59c4415..1ee7364 100644 --- a/frontend/views/database/a-index.php +++ b/frontend/views/database/a-index.php @@ -1,302 +1,193 @@ - - - - - - - - - - - - - - - - - - - - - - -
- 车牌: - 发动机号: - 车架号: - 车主: - 联系电话: -
- 初登日期:从截止 - - 保险日期: - 月 - 日 - 至 - 月 - 日 - - - 保险公司: - - -
- 范围: - - - - - - - - - - - -
- - - - - - - - - - -
-
- - - - - - - - - - - - - - - - $item) { - ?> - - - - - - - - - - - - - - - - - - -
车牌车型车主联系电话初登日期保险日期保险公司发动机号车架号位置操作
car_no?>factory_model,10)?>car_man,10)?>phone?>register_date?>insurer1_date?>company?>engine_no?>car_frame_no?>getLocation()?> - [修改] - location == 1) { - ?> - [删除] - -
-
- \ No newline at end of file +endBlock(); ?> diff --git a/frontend/views/gift/ajax-car-index.php b/frontend/views/gift/ajax-car-index.php deleted file mode 100644 index f5660c6..0000000 --- a/frontend/views/gift/ajax-car-index.php +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - $item) { - if(!$item->gift) continue; - ?> - - - - - - - - - - - - -
序号礼品名称类型描述分类添加者操作时间状态相关操作
gift->name?>gift->type->name?>gift->remark?>strategy_id>0?'公司礼品':'自费礼品'?>user?$item->user->getShowName():''?>submit_time)?>status == 0) echo '未出库'; - if($item->status == 1) echo '已出库'; - if($item->status == 2) echo '正在退换'; - ?> - strategy_id > 0 || $item->status > 0) { - echo ''; - } else { - echo '[删除]'; - } - ?> -
diff --git a/frontend/views/gift/ajax-company-index.php b/frontend/views/gift/ajax-company-index.php deleted file mode 100644 index f46276f..0000000 --- a/frontend/views/gift/ajax-company-index.php +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - -
name?> - where('order_id='.$order_id.' and strategy_id='.$item->id) - ->all(); - $tmp_ids = array(); - foreach($my_gifts as $my_gift) { - $tmp_ids[] = $my_gift->gift_id; - } - $my_gift_total = count($tmp_ids); - for($i = 0; $i < $item->sel_count; $i++) { - echo '礼品: '; - echo ''; - } - ?> -
- diff --git a/frontend/views/gift/edit.php b/frontend/views/gift/edit.php index 52c2a7c..45b7b5e 100644 --- a/frontend/views/gift/edit.php +++ b/frontend/views/gift/edit.php @@ -1,82 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称 - -
所属分类 - -
价格 - -
描述 - -
总数量 - -
锁定量 - -
- -    - -
- - - + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
+
+
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ + +
+
选择文件
+
开始上传
+   图片尺寸255x255,透明背景 +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +beginBlock('footer_js'); ?> + +endBlock('footer_js'); ?> diff --git a/frontend/views/gift/gift-out.php b/frontend/views/gift/gift-out.php new file mode 100644 index 0000000..2a08279 --- /dev/null +++ b/frontend/views/gift/gift-out.php @@ -0,0 +1,170 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
礼品出库
+ +
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+
+ + + +
+
+ +
+
+ + + +
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + +
ID礼品编号礼品车牌号车架号提单人出库时间状态操作员操作
+
+
+
+
+
+ + +beginBlock('footer_js'); ?> + + + + +endBlock(); ?> diff --git a/frontend/views/gift/gift-tj.php b/frontend/views/gift/gift-tj.php new file mode 100644 index 0000000..609026a --- /dev/null +++ b/frontend/views/gift/gift-tj.php @@ -0,0 +1,96 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
礼品统计
+ +
+
+
+
+ +
+ +
+
+
+ + + +
+
+
+ +
+
+
+
+
+ + + + + + + + + + +
ID名称库存待出库已出库
+
+
+
+
+
+ + +beginBlock('footer_js'); ?> + + + + +endBlock(); ?> diff --git a/frontend/views/gift/gift-use.php b/frontend/views/gift/gift-use.php new file mode 100644 index 0000000..4a64481 --- /dev/null +++ b/frontend/views/gift/gift-use.php @@ -0,0 +1,172 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
礼券使用
+ +
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+
+ + + +
+
+ +
+
+ + + +
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + +
ID礼券编号礼品车牌号车架号发放日期有效期日期提单人使用日期状态操作员操作
+
+
+
+
+
+ + +beginBlock('footer_js'); ?> + + + + +endBlock(); ?> diff --git a/frontend/views/gift/gift2-edit.php b/frontend/views/gift/gift2-edit.php deleted file mode 100644 index 30affc9..0000000 --- a/frontend/views/gift/gift2-edit.php +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
编号 - - 名称 - -
车牌号 - - 联系电话 - -
商业保单号 - - 交强保单号 - -
状态 - status==0?'checked':''?>>未使用 - status==1?'checked':''?>>出库 - status==2?'checked':''?>>回收 -
入库时间input_time?>
出库时间output_time?>
回收时间return_time?>
- -    - -
- - - - diff --git a/frontend/views/gift/gift2-list.php b/frontend/views/gift/gift2-list.php deleted file mode 100644 index 7b4e5a0..0000000 --- a/frontend/views/gift/gift2-list.php +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - -
- 编号: - 名称: - 电话: - 车牌: - - -
- - - - - - - - - - - - - - - $item) { - $start_index = ($page - 1) * 20 + $index; - ?> - - - - - - - - - - - - - - - - - -
序号编号名称车牌号入库时间出库时间回收时间状态操作员操作时间操作
code?>name?>car_no?>input_time?>output_time?>return_time?>getStatus()?> user?$item->user->getShowName():''?>updated_at?> - [详情] -
diff --git a/frontend/views/gift/gift3-edit.php b/frontend/views/gift/gift3-edit.php deleted file mode 100644 index 61462ca..0000000 --- a/frontend/views/gift/gift3-edit.php +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
礼券编号 - - 礼品名称 - -
车牌号 - - 联系电话 - -
商业保单号 - - 交强保单号 - -
状态 - status==0?'checked':''?>>未使用 - status==1?'checked':''?>>出库 - status==2?'checked':''?>>回收 -
入库时间input_time?>
出库时间output_time?>
回收时间return_time?>
- -    - -
- - - - diff --git a/frontend/views/gift/gift3-list.php b/frontend/views/gift/gift3-list.php deleted file mode 100644 index cfd9d3d..0000000 --- a/frontend/views/gift/gift3-list.php +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - -
- 礼券编号: - 名称: - 电话: - 车牌: - - -
- - - - - - - - - - - - - - - $item) { - $start_index = ($page - 1) * 20 + $index; - ?> - - - - - - - - - - - - - - - - - -
序号礼券编号名称车牌号入库时间出库时间回收时间状态操作员操作时间操作
code?>name?>car_no?>input_time?>output_time?>return_time?>getStatus()?> user?$item->user->getShowName():''?>updated_at?> - [详情] -
diff --git a/frontend/views/gift/index.php b/frontend/views/gift/index.php index 3b7424b..e68fe6f 100644 --- a/frontend/views/gift/index.php +++ b/frontend/views/gift/index.php @@ -1,76 +1,124 @@ - - - - + + + - - - - - - -
- 名称: - - -
- - - - - - - - - - - - $item) { - ?> - - - - - - - - - - - -
序号名称所属类型价格描述总数量锁定量操作
name?>type?$item->type->name:''?>price?>remark,70)?>total?>total_lock?> - [修改] - -
+endBlock(); ?> diff --git a/frontend/views/gift/stastics.php b/frontend/views/gift/stastics.php new file mode 100644 index 0000000..5cc4686 --- /dev/null +++ b/frontend/views/gift/stastics.php @@ -0,0 +1,65 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
礼品盘库
+ +
+
+
+
+ + + + + + + + + + +
ID名称总数量已出库已使用
+
+
+
+
+
+ + +beginBlock('footer_js'); ?> + + + + +endBlock(); ?> diff --git a/frontend/views/gift/ticket-tj.php b/frontend/views/gift/ticket-tj.php new file mode 100644 index 0000000..74a380f --- /dev/null +++ b/frontend/views/gift/ticket-tj.php @@ -0,0 +1,96 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
礼券统计
+ +
+
+
+
+ +
+ +
+
+
+ + + +
+
+
+ +
+
+
+
+
+ + + + + + + + + + +
ID名称库存待出库已出库
+
+
+
+
+
+ + +beginBlock('footer_js'); ?> + + + + +endBlock(); ?> diff --git a/frontend/views/layouts/blue-main.php b/frontend/views/layouts/blue-main.php index 993c57a..e2763a6 100644 --- a/frontend/views/layouts/blue-main.php +++ b/frontend/views/layouts/blue-main.php @@ -15,6 +15,9 @@ use yii\helpers\Html; + + + blocks['header_css'])): ?> blocks['header_css'] ?> @@ -28,6 +31,7 @@ use yii\helpers\Html; + diff --git a/frontend/views/marketing-strategy/add.php b/frontend/views/marketing-strategy/add.php new file mode 100644 index 0000000..4dc12d4 --- /dev/null +++ b/frontend/views/marketing-strategy/add.php @@ -0,0 +1,95 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
+
+
+ +
+ +
+ +
+
+
+ +
+
+ 日期 + + 时间 + +
+
+ +
+
+ 日期 + + 时间 + +
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +beginBlock('footer_js'); ?> + + +endBlock('footer_js'); ?> diff --git a/frontend/views/marketing-strategy/edit.php b/frontend/views/marketing-strategy/edit.php new file mode 100644 index 0000000..248b4b7 --- /dev/null +++ b/frontend/views/marketing-strategy/edit.php @@ -0,0 +1,104 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
营销策略 - 编辑 - celuo_name?>
+ +
+
+
+
+
+ + +
+ +
+ +
+
+
+ +
+
+ 日期 + + 时间 + +
+
+ +
+
+ 日期 + + 时间 + +
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+ +beginBlock('footer_js'); ?> + + +endBlock('footer_js'); ?> diff --git a/frontend/views/marketing-strategy/index.php b/frontend/views/marketing-strategy/index.php new file mode 100644 index 0000000..60db931 --- /dev/null +++ b/frontend/views/marketing-strategy/index.php @@ -0,0 +1,101 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
营销策略
+ +
+
+
+
+ + + + + + + + + + + +
ID策略名字开始日期截止日期策略描述操作
+
+
+
+
+
+ + +beginBlock('footer_js'); ?> + + + + +endBlock(); ?> diff --git a/frontend/views/permissions/permission.php b/frontend/views/permissions/permission.php index 51f9b39..448ed78 100644 --- a/frontend/views/permissions/permission.php +++ b/frontend/views/permissions/permission.php @@ -15,16 +15,22 @@ use \common\libs\MyLib;
- +
+
+ +
+
menus as $sub_item) { ?> -
- +
+
+ +
diff --git a/frontend/views/user/edit.php b/frontend/views/user/edit.php index 1dcd7cd..5ae04a3 100644 --- a/frontend/views/user/edit.php +++ b/frontend/views/user/edit.php @@ -1,244 +1,162 @@ - - - - - - +beginBlock('header_css'); ?> +endBlock(); ?> - - -
-
- - - - - - - - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
工号id == 1) { - echo $info->username; - } else { - echo ''; +
+
+
+ + +
+ +
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+
登录密码
姓名联系电话
电话分机 - - 电话服务器 - -
所属公司 - - 所属部门 - -
所属岗位 - - 允许登录 - -
角色 - - 允许外网登陆 - -
业务分组 - - 是否离职 - -
是否送单 - -
- - - - - - - -
- - - - - - - - - - - - - + ?> + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+ + +
+
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+ +
+
+
+
+
+
+
入职日期 - - 转正时间 - -
调整工资总工资0.00
+ - - - - + + - - - - - - -
试用工资(%) - % - 试用工资 - 元 - 权限一级菜单(二级菜单)
工作制 - - 是否双休 - -
- - + - - - - -
- - - - - getMenus() @@ -248,7 +166,7 @@ use \common\libs\MyLib; -
权限一级菜单(二级菜单)
'; + echo '
+ + + + +
+
+
+ +
+
+
-
- -    - -
- - - - +endBlock('footer_js'); ?> diff --git a/frontend/views/user/index.php b/frontend/views/user/index.php index eddbd91..91b6693 100644 --- a/frontend/views/user/index.php +++ b/frontend/views/user/index.php @@ -1,192 +1,147 @@ - - - - - - - - - - - - - - -
- 工号: - 真实姓名: - 电话: - 是否离职: - - 分组: - -
- - -
- - - - - - - - - - - - - - - $item) { - ?> - - - - - - - - - - - - - - - - - -
- - 工号真实姓名联系电话允许登录所属岗位角色是否离职状态操作
username?>name?>phone?>is_login==1?'是':''?>group?$item->group->getPath():''?>role?$item->role->name:''?>is_leave?'已离职':''?> - is_delete === 0) && ($item->is_login === 1)){ - echo ''; - }else if(($item->is_delete === 1) && ($item->is_login === 0)){ - echo '×'; - }else{ - echo '?'; - } - ?> - - [修改] - username != 'admin') { - ?> - [删除] - -
- +beginBlock('footer_js'); ?> + + + +endBlock(); ?> diff --git a/frontend/web/upload/images/201909/15686851959974.png b/frontend/web/upload/images/201909/15686851959974.png new file mode 100644 index 0000000..e6f46da Binary files /dev/null and b/frontend/web/upload/images/201909/15686851959974.png differ diff --git a/frontend/web/upload/images/201909/15686854453839.png b/frontend/web/upload/images/201909/15686854453839.png new file mode 100644 index 0000000..e6f46da Binary files /dev/null and b/frontend/web/upload/images/201909/15686854453839.png differ diff --git a/frontend/web/upload/images/201909/15686863351383.png b/frontend/web/upload/images/201909/15686863351383.png new file mode 100644 index 0000000..e6f46da Binary files /dev/null and b/frontend/web/upload/images/201909/15686863351383.png differ diff --git a/frontend/web/upload/images/201909/15686863679475.png b/frontend/web/upload/images/201909/15686863679475.png new file mode 100644 index 0000000..e6f46da Binary files /dev/null and b/frontend/web/upload/images/201909/15686863679475.png differ diff --git a/frontend/web/upload/images/201909/15686864234031.png b/frontend/web/upload/images/201909/15686864234031.png new file mode 100644 index 0000000..756c4a0 Binary files /dev/null and b/frontend/web/upload/images/201909/15686864234031.png differ diff --git a/frontend/web/upload/images/201909/15686880989718.jpg b/frontend/web/upload/images/201909/15686880989718.jpg new file mode 100644 index 0000000..257e27a Binary files /dev/null and b/frontend/web/upload/images/201909/15686880989718.jpg differ