diff --git a/common/libs/MyLib.php b/common/libs/MyLib.php index 023675f..85efc26 100644 --- a/common/libs/MyLib.php +++ b/common/libs/MyLib.php @@ -8,8 +8,6 @@ namespace common\libs; -use common\models\PriceT; - /** * Description of MyLib * @@ -281,114 +279,67 @@ class MyLib { return $result; } - /** - * 批量处理信息 - * @param $type - * @param $data1 - * @param null $data2 - * @return array - */ - public static function GetInfosResponse($type, $data1, $data2 = null) - { - switch ($type){ - case 'car': // $data1=>$car_info - $funcname = 'GetCarInfoResponse';break; - case 'order': // $data1=>$orders_info - $funcname = 'GetOrderInfoResponse';break; - case 'insurer_type': // $data1=>$insurer_types_info, $data2=>$order_id - $funcname = 'GetInsurerTypeInfoResponse';break; - case 'gift': // $data1=>$order_gifts_info - $funcname = 'GetGiftInfoResponse';break; - case 'history': // $data1=>$car_log_info - $funcname = 'GetCarLogResponse';break; - } - $infos = []; - foreach ($data1 as $item){ - $infos[] = self::$funcname($item,$data2); - } - return $infos; - } - - /** - * 处理车辆信息(将id字段转换为对应文本) - * @param $car_info @结果集 - * @return array - */ - public static function GetCarInfoResponse($car_info) - { - $car_info_arr = $car_info->toArray(); - $car_info_arr['brand_txt'] = $car_info->brand ? $car_info->brand->name : ''; - $car_info_arr['car_type_txt'] = $car_info->carType ? $car_info->carType->name : ''; - $car_info_arr['car_use_txt'] = $car_info->carUse ? $car_info->carUse->name : ''; - $car_info_arr['car_use_txt'] = $car_info->carUse ? $car_info->carUse->name : ''; - $car_info_arr['series_txt'] = $car_info->series ? $car_info->series->name : ''; - $car_info_arr['displacement_txt'] = $car_info->displacement ? $car_info->displacement->name : ''; - $car_info_arr['location_txt'] = $car_info->location == 3 ? '本区' : ($car_info->location == 6 ? '外区' : '未知'); - return $car_info_arr; - } - - /** - * 处理订单信息(将id字段转换为对应文本) - * @param $order_info @结果集 - * @return array - */ - public static function GetOrderInfoResponse($order_info) - { - $order_info_arr = $order_info->toArray(); - $order_info_arr['business_group_name'] = $order_info->businessGroup ? $order_info->businessGroup->name : ''; - $order_info_arr['company_name'] = $order_info->company ? $order_info->company->name : ''; - $order_info_arr['pay_type_txt'] = ($order_info->shoufei_id?MyLib::zhifufs($order_info->shoufei_id).'-':'').($order_info->payType?$order_info->payType->name:''); - $order_info_arr['payee_name'] = $order_info->payee_id?$order_info->payee->name:''; - $order_info_arr['payer_name'] = $order_info->payer? MyLib::payers($order_info->payer):''; - $order_info_arr['payment_name'] = $order_info->payment_id?$order_info->payment->name:''; - $order_info_arr['receiver_addr_txt'] = $order_info->receiver_province. - $order_info->receiver_city. - $order_info->receiver_county. - $order_info->receiver_address; - return $order_info_arr; - } + static public function phoneCenterStatus($cx){ + if($cx=='ANSWERED') { + $cn='通话成功'; + }elseif($cx=='BUSY') { + $cn = '被叫忙'; + }elseif($cx=='NO_ANSWER') { + $cn = '被叫无应答'; + }elseif($cx=='REJECT') { + $cn = '被叫拒接'; + }elseif($cx=='HANGUP') { + $cn = '主叫提前挂机'; + }elseif($cx=='INVALID_NUMBER') { + $cn = '空号'; + }elseif($cx=='POWER_OFF') { + $cn = '关机'; + }elseif($cx=='UNAVAILABLE') { + $cn = '暂时无法接听'; + }elseif($cx=='SUSPEND') { + $cn = '停机'; + }elseif($cx=='TP_NO_BINDING') { + $cn = '无绑定关系'; + }elseif($cx=='TP_TIMEOUT') { + $cn = '号码查询接口超时'; + }elseif($cx=='BLACK') { + $cn = '黑名单号码'; + }elseif($cx=='TP_ERROR') { + $cn = '号码查询接口解析错误'; - /** - * 处理险种信息 - * @param $insurer_type_info - * @param $order_id - * @return array - */ - public static function GetInsurerTypeInfoResponse($insurer_type_info,$order_id) - { - $price_info = PriceT::find() - ->where('order_id='.$order_id.' and type_id='.$insurer_type_info->id) - ->one(); - $insurer_type_info_arr = $insurer_type_info->toArray(); - $insurer_type_info_arr['show_name'] = $insurer_type_info->name.'('.$insurer_type_info->code.')'; - $insurer_type_info_arr['show_content'] = $price_info->val; - $insurer_type_info_arr['is_nopay_txt'] = $price_info->is_nopay==1?'是': '否'; - return $insurer_type_info_arr; + }elseif($cx=='CALLED_BLACK') { + $cn = '被叫不支持'; + }elseif($cx=='CALL_FORWARD') { + $cn = '呼叫转移'; + }elseif($cx=='OTHER') { + $cn = '其他失败情形'; + } + return $cn; } - /** - * 处理礼品信息 - * @param $order_gift - * @return array - */ - public static function GetGiftInfoResponse($order_gift) - { - $gift_info = $order_gift->toArray(); - $gift_info['gift_name'] = $order_gift->gift->name; - $gift_info['group_name'] = $order_gift->group->name; - return $gift_info; + static public function HMSByTime($time){ + $h=$i=$s=0; + if($time >= 3600){ + $h = floor($time/3600); + $time = ($time%3600); + } + if($time >= 60){ + $i = floor($time/60); + $time = ($time%60); + } + $s = floor($time); + return $h.':'.$i.':'.$s; } - /** - * 处理操作记录 - * @param $log - * @return array - */ - public static function GetCarLogResponse($log) + static public function HMSByTimeBuy($time) { - $log_info = $log->toArray(); - $log_info['op_time_txt'] = date('Y-m-d H:i:s',$log->op_time); - return $log_info; + $i = 0; + if($time > 0 && $time <60){ + $i = 1; + }elseif($time >= 60){ + $i = ceil($time/60); + } + return $i; } } diff --git a/common/models/CarT.php b/common/models/CarT.php index ae9159e..1873bb0 100644 --- a/common/models/CarT.php +++ b/common/models/CarT.php @@ -65,7 +65,7 @@ class CarT extends \common\models\Base public function rules() { return [ - [['user_id', 'car_type_id', 'car_use_id'], 'required'], + [['user_id', 'car_use_id'], 'required'], [['user_id', 'car_type_id', 'car_use_id','seats','brand_id','series_id','displacement_id','location','invalid_id','invalid_flag','is_track','times','biaozhu','hiddenes'], 'integer'], [['register_date', 'insurer1_date', 'insurer2_date','id_man','id_number','print_date','car_man_number', 'created_at', 'updated_at'], 'safe'], [['car_no', 'factory_model', 'car_model', 'engine_no', 'car_frame_no','old_user','phone1','id_phone'], 'string', 'max' => 50], diff --git a/common/models/OrderGiftT.php b/common/models/OrderGiftT.php index a8b0b15..88c902b 100644 --- a/common/models/OrderGiftT.php +++ b/common/models/OrderGiftT.php @@ -84,6 +84,6 @@ class OrderGiftT extends \common\models\Base public function getGift() { - return $this->hasOne(GiftType3T::className(),['id'=>'gift_id']); + return $this->hasOne(GiftT::className(),['id'=>'gift_id']); } } diff --git a/common/models/UserT.php b/common/models/UserT.php index 27e1896..4430d81 100644 --- a/common/models/UserT.php +++ b/common/models/UserT.php @@ -2,6 +2,7 @@ namespace common\models; +use common\libs\MyLib; use Yii; /** @@ -288,4 +289,204 @@ class UserT extends \common\models\Base return $pay_chexian + $pay_nochexian + $pay_dz; } + + public function totalCallNum($begin_date,$end_date) + { + $query = NetworkPhoneT::find()->where('user_id='.$this->id); + if($begin_date != ''){ + $query = $query->andWhere('begin_date>="'.$begin_date.'"'); + } + if($end_date != ''){ + $query = $query->andWhere('begin_date<="'.$end_date.'"'); + } + + return $query->count(); + } + + static public function totalCallTotallNum($begin_date,$end_date,$company_id,$user_id) + { + $query = NetworkPhoneT::find() + ->leftJoin('user_t','user_t.id=network_phone_t.user_id'); + if($begin_date != ''){ + $query = $query->andWhere('network_phone_t.begin_date>="'.$begin_date.'"'); + } + if($end_date != ''){ + $query = $query->andWhere('network_phone_t.begin_date<="'.$end_date.'"'); + } + if($company_id != 0){ + $query = $query->andWhere('user_t.company_id='.$company_id); + } + if($user_id != 0){ + $query = $query->andWhere('user_t.id='.$user_id); + } + + return $query->count(); + } + + public function totalCallTime($begin_date,$end_date) + { + $query = NetworkPhoneT::find()->where('user_id='.$this->id); + if($begin_date != ''){ + $query = $query->andWhere('begin_date>="'.$begin_date.'"'); + } + if($end_date != ''){ + $query = $query->andWhere('begin_date<="'.$end_date.'"'); + } + $time = $query->sum('call_duration'); + + return MyLib::HMSByTime($time); + } + + public function totalCallTimeOut($begin_date,$end_date) + { + $query = NetworkPhoneT::find()->where('user_id='.$this->id)->andWhere('is_called=0 or is_called is null'); + if($begin_date != ''){ + $query = $query->andWhere('begin_date>="'.$begin_date.'"'); + } + if($end_date != ''){ + $query = $query->andWhere('begin_date<="'.$end_date.'"'); + } + $time = $query->sum('call_duration'); + + return MyLib::HMSByTime($time); + } + + static public function allCallTime($begin_date,$end_date,$company_id,$user_id) + { + $query = NetworkPhoneT::find() + ->leftJoin('user_t','user_t.id=network_phone_t.user_id'); + if($begin_date != ''){ + $query = $query->andWhere('network_phone_t.begin_date>="'.$begin_date.'"'); + } + if($end_date != ''){ + $query = $query->andWhere('network_phone_t.begin_date<="'.$end_date.'"'); + } + if($company_id != 0){ + $query = $query->andWhere('user_t.company_id='.$company_id); + } + if($user_id != 0){ + $query = $query->andWhere('user_t.id='.$user_id); + } + $time = $query->sum('network_phone_t.call_duration'); + + return MyLib::HMSByTime($time); + } + static public function allCallTimeOut($begin_date,$end_date,$company_id,$user_id) + { + $query = NetworkPhoneT::find()->where('is_called=0') + ->leftJoin('user_t','user_t.id=network_phone_t.user_id'); + if($begin_date != ''){ + $query = $query->andWhere('network_phone_t.begin_date>="'.$begin_date.'"'); + } + if($end_date != ''){ + $query = $query->andWhere('network_phone_t.begin_date<="'.$end_date.'"'); + } + if($company_id != 0){ + $query = $query->andWhere('user_t.company_id='.$company_id); + } + if($user_id != 0){ + $query = $query->andWhere('user_t.id='.$user_id); + } + $time = $query->sum('network_phone_t.call_duration'); + + return MyLib::HMSByTime($time); + } + + static public function allCallTimeOutBuy($begin_date,$end_date,$company_id,$user_id) + { + $query = NetworkPhoneT::find() + ->leftJoin('user_t','user_t.id=network_phone_t.user_id'); + if($begin_date != ''){ + $query = $query->andWhere('network_phone_t.begin_date>="'.$begin_date.'"'); + } + if($end_date != ''){ + $query = $query->andWhere('network_phone_t.begin_date<="'.$end_date.'"'); + } + if($company_id != 0){ + $query = $query->andWhere('user_t.company_id='.$company_id); + } + if($user_id != 0){ + $query = $query->andWhere('user_t.id='.$user_id); + } + $items = $query->all(); + $i_all = 0; + foreach ($items as $item){ + $i = $item->call_duration; + $i_all += MyLib::HMSByTimeBuy($i); + + } + + return $i_all; + } + + public function callInTotalNum($begin_date,$end_date) + { + $t = NetworkPhoneAssignT::find()->where('user_id='.$this->id)->one(); + $phone = $t?$t->phone:0; + + $query = NetworkPhoneT::find()->where('user_id='.$this->id); + if($begin_date != ''){ + $query = $query->andWhere('begin_date>="'.$begin_date.'"'); + } + if($end_date != ''){ + $query = $query->andWhere('begin_date<="'.$end_date.'"'); + } + + return $query->andWhere('is_called=1')->count(); + } + + public function callInSucNum($begin_date,$end_date) + { + $t = NetworkPhoneAssignT::find()->where('user_id='.$this->id)->one(); + $phone = $t?$t->phone:0; + + $query = NetworkPhoneT::find()->where('user_id='.$this->id); + if($begin_date != ''){ + $query = $query->andWhere('begin_date>="'.$begin_date.'"'); + } + if($end_date != ''){ + $query = $query->andWhere('begin_date<="'.$end_date.'"'); + } + + return $query->andWhere('is_called=1')->andWhere('call_result="ANSWERED"')->count(); + } + + public function callOutTotalNum($begin_date,$end_date) + { + $t = NetworkPhoneAssignT::find()->where('user_id='.$this->id)->one(); + $phone = $t?$t->phone:0; + + $query = NetworkPhoneT::find()->where('user_id='.$this->id); + if($begin_date != ''){ + $query = $query->andWhere('begin_date>="'.$begin_date.'"'); + } + if($end_date != ''){ + $query = $query->andWhere('begin_date<="'.$end_date.'"'); + } + +// return $query->andWhere('caller="'.$phone.'"')->count(); + + return $query->andWhere('is_called=0 or is_called is null')->count(); + } + + public function callOutSucNum($begin_date,$end_date) + { + $t = NetworkPhoneAssignT::find()->where('user_id='.$this->id)->one(); + $phone = $t?$t->phone:0; + + $query = NetworkPhoneT::find()->where('user_id='.$this->id); + if($begin_date != ''){ + $query = $query->andWhere('begin_date>="'.$begin_date.'"'); + } + if($end_date != ''){ + $query = $query->andWhere('begin_date<="'.$end_date.'"'); + } + + return $query->andWhere('is_called=0 or is_called is null')->andWhere('call_result="ANSWERED"')->count(); + } + + public function getPhoneStatus() + { + return $this->hasOne(NetworkPhoneAssignT::className(),['user_id'=>'id']); + } } diff --git a/composer.json b/composer.json index e5752b8..4d25cdc 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,9 @@ "yiisoft/yii2-bootstrap": "*", "yiisoft/yii2-swiftmailer": "*", "phpoffice/phpspreadsheet": "^1.9", - "codeception/codeception": "^3.1" + "codeception/codeception": "^3.1", + "yiisoft/yii2-imagine": "^2.2", + "phpoffice/phpexcel": "^1.8" }, "require-dev": { "yiisoft/yii2-debug": "*", @@ -34,5 +36,11 @@ "npm-asset-library": "vendor/npm", "bower-asset-library": "vendor/bower" } + }, + "repositories": { + "packagist": { + "type": "composer", + "url": "https://mirrors.aliyun.com/composer/" + } } } diff --git a/composer.lock b/composer.lock index 6096380..9652f66 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5ef26788c00e2aefd589a66715e24ac0", + "content-hash": "4e10a054c08f42ba7431449d509147d7", "packages": [ { "name": "behat/gherkin", @@ -18,7 +18,13 @@ "type": "zip", "url": "https://api.github.com/repos/Behat/Gherkin/zipball/ab0a02ea14893860bca00f225f5621d351a3ad07", "reference": "ab0a02ea14893860bca00f225f5621d351a3ad07", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.3.1" @@ -282,7 +288,13 @@ "type": "zip", "url": "https://api.github.com/repos/cebe/markdown/zipball/9bac5e971dd391e2802dca5400bbeacbaea9eb86", "reference": "9bac5e971dd391e2802dca5400bbeacbaea9eb86", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "lib-pcre": "*", @@ -342,7 +354,13 @@ "type": "zip", "url": "https://api.github.com/repos/Codeception/Codeception/zipball/afc52609e590998fd293028699ad4a61d6afd7bc", "reference": "afc52609e590998fd293028699ad4a61d6afd7bc", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "behat/gherkin": "^4.4.0", @@ -437,7 +455,13 @@ "type": "zip", "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/7090736f36b4398cae6ef838b9a2bdfe8d8d104b", "reference": "7090736f36b4398cae6ef838b9a2bdfe8d8d104b", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=7.2", @@ -481,7 +505,13 @@ "type": "zip", "url": "https://api.github.com/repos/Codeception/Stub/zipball/016a035c287c898745504f7f2916f4dae14265e0", "reference": "016a035c287c898745504f7f2916f4dae14265e0", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "codeception/phpunit-wrapper": "^8.0.4", @@ -512,7 +542,13 @@ "type": "zip", "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", "reference": "a2c590166b2133a4633738648b6b064edae0814a", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1" @@ -568,7 +604,13 @@ "type": "zip", "url": "https://api.github.com/repos/doctrine/lexer/zipball/e17f069ede36f7534b95adec71910ed1b49c74ea", "reference": "e17f069ede36f7534b95adec71910ed1b49c74ea", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.2" @@ -630,7 +672,13 @@ "type": "zip", "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/92dd169c32f6f55ba570c309d83f5209cefb5e23", "reference": "92dd169c32f6f55ba570c309d83f5209cefb5e23", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "doctrine/lexer": "^1.0.1", @@ -688,7 +736,13 @@ "type": "zip", "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/83ab08bc1af7d808a9e0fbf024f1c24bfd73c0a7", "reference": "83ab08bc1af7d808a9e0fbf024f1c24bfd73c0a7", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.2" @@ -735,7 +789,13 @@ "type": "zip", "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/e43de70f3c7166169d0f14a374505392734160e5", "reference": "e43de70f3c7166169d0f14a374505392734160e5", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "ext-curl": "*", @@ -795,7 +855,13 @@ "type": "zip", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba", "reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "guzzlehttp/promises": "^1.0", @@ -860,7 +926,13 @@ "type": "zip", "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.5.0" @@ -911,7 +983,13 @@ "type": "zip", "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", "reference": "239400de7a173fe9901b9ac7c06497751f00727a", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.4.0", @@ -982,7 +1060,13 @@ "type": "zip", "url": "https://api.github.com/repos/hoaproject/Consistency/zipball/fd7d0adc82410507f332516faf655b6ed22e4c2f", "reference": "fd7d0adc82410507f332516faf655b6ed22e4c2f", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "hoa/exception": "~1.0", @@ -1045,7 +1129,13 @@ "type": "zip", "url": "https://api.github.com/repos/hoaproject/Console/zipball/e231fd3ea70e6d773576ae78de0bdc1daf331a66", "reference": "e231fd3ea70e6d773576ae78de0bdc1daf331a66", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "hoa/consistency": "~1.0", @@ -1121,7 +1211,13 @@ "type": "zip", "url": "https://api.github.com/repos/hoaproject/Event/zipball/6c0060dced212ffa3af0e34bb46624f990b29c54", "reference": "6c0060dced212ffa3af0e34bb46624f990b29c54", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "hoa/consistency": "~1.0", @@ -1177,7 +1273,13 @@ "type": "zip", "url": "https://api.github.com/repos/hoaproject/Exception/zipball/091727d46420a3d7468ef0595651488bfc3a458f", "reference": "091727d46420a3d7468ef0595651488bfc3a458f", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "hoa/consistency": "~1.0", @@ -1231,7 +1333,13 @@ "type": "zip", "url": "https://api.github.com/repos/hoaproject/File/zipball/35cb979b779bc54918d2f9a4e02ed6c7a1fa67ca", "reference": "35cb979b779bc54918d2f9a4e02ed6c7a1fa67ca", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "hoa/consistency": "~1.0", @@ -1293,7 +1401,13 @@ "type": "zip", "url": "https://api.github.com/repos/hoaproject/Iterator/zipball/d1120ba09cb4ccd049c86d10058ab94af245f0cc", "reference": "d1120ba09cb4ccd049c86d10058ab94af245f0cc", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "hoa/consistency": "~1.0", @@ -1347,7 +1461,13 @@ "type": "zip", "url": "https://api.github.com/repos/hoaproject/Protocol/zipball/5c2cf972151c45f373230da170ea015deecf19e2", "reference": "5c2cf972151c45f373230da170ea015deecf19e2", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "hoa/consistency": "~1.0", @@ -1407,7 +1527,13 @@ "type": "zip", "url": "https://api.github.com/repos/hoaproject/Stream/zipball/3293cfffca2de10525df51436adf88a559151d82", "reference": "3293cfffca2de10525df51436adf88a559151d82", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "hoa/consistency": "~1.0", @@ -1471,7 +1597,13 @@ "type": "zip", "url": "https://api.github.com/repos/hoaproject/Ustring/zipball/e6326e2739178799b1fe3fdd92029f9517fa17a0", "reference": "e6326e2739178799b1fe3fdd92029f9517fa17a0", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "hoa/consistency": "~1.0", @@ -1519,6 +1651,70 @@ ], "time": "2017-01-16T07:08:25+00:00" }, + { + "name": "imagine/imagine", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/avalanche123/Imagine.git", + "reference": "eec39b2092bc8008a92b8d63824476413dbe7511" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/avalanche123/Imagine/zipball/eec39b2092bc8008a92b8d63824476413dbe7511", + "reference": "eec39b2092bc8008a92b8d63824476413dbe7511", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "2.2.*", + "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5 || ^7.4" + }, + "suggest": { + "ext-gd": "to use the GD implementation", + "ext-gmagick": "to use the Gmagick implementation", + "ext-imagick": "to use the Imagick implementation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.7-dev" + } + }, + "autoload": { + "psr-4": { + "Imagine\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bulat Shakirzyanov", + "email": "mallluhuct@gmail.com", + "homepage": "http://avalanche123.com" + } + ], + "description": "Image processing for PHP 5.3", + "homepage": "http://imagine.readthedocs.org/", + "keywords": [ + "drawing", + "graphics", + "image manipulation", + "image processing" + ], + "time": "2019-07-09T06:55:48+00:00" + }, { "name": "markbaker/complex", "version": "1.4.7", @@ -1531,7 +1727,13 @@ "type": "zip", "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/1ea674a8308baf547cbcbd30c5fcd6d301b7c000", "reference": "1ea674a8308baf547cbcbd30c5fcd6d301b7c000", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^5.6.0|^7.0.0" @@ -1626,7 +1828,13 @@ "type": "zip", "url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/5348c5a67e3b75cd209d70103f916a93b1f1ed21", "reference": "5348c5a67e3b75cd209d70103f916a93b1f1ed21", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^5.6.0|^7.0.0" @@ -1695,7 +1903,13 @@ "type": "zip", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1" @@ -1743,7 +1957,13 @@ "type": "zip", "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "ext-dom": "*", @@ -1798,7 +2018,13 @@ "type": "zip", "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^5.6 || ^7.0" @@ -1845,7 +2071,13 @@ "type": "zip", "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=7.1" @@ -1897,7 +2129,13 @@ "type": "zip", "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.0", @@ -1948,7 +2186,13 @@ "type": "zip", "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1", @@ -1983,6 +2227,75 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "time": "2019-08-22T18:11:29+00:00" }, + { + "name": "phpoffice/phpexcel", + "version": "1.8.2", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PHPExcel.git", + "reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870", + "reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "php": "^5.2|^7.0" + }, + "require-dev": { + "squizlabs/php_codesniffer": "2.*" + }, + "type": "library", + "autoload": { + "psr-0": { + "PHPExcel": "Classes/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "http://blog.maartenballiauw.be" + }, + { + "name": "Erik Tilt" + }, + { + "name": "Franck Lefevre", + "homepage": "http://rootslabs.net" + }, + { + "name": "Mark Baker", + "homepage": "http://markbakeruk.net" + } + ], + "description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "https://github.com/PHPOffice/PHPExcel", + "keywords": [ + "OpenXML", + "excel", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "abandoned": "phpoffice/phpspreadsheet", + "time": "2018-11-22T23:07:24+00:00" + }, { "name": "phpoffice/phpspreadsheet", "version": "1.9.0", @@ -1995,7 +2308,13 @@ "type": "zip", "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/8dea03eaf60a349b6097e4bcad11f894668280df", "reference": "8dea03eaf60a349b6097e4bcad11f894668280df", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "ext-ctype": "*", @@ -2088,7 +2407,13 @@ "type": "zip", "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "doctrine/instantiator": "^1.0.2", @@ -2151,7 +2476,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa0d179a13284c7420fc281fc32750e6cc7c9e2f", "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "ext-dom": "*", @@ -2214,7 +2545,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", "reference": "050bedf145a257b1ff02746c31894800e5122946", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1" @@ -2264,7 +2601,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.3.3" @@ -2305,7 +2648,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1" @@ -2354,7 +2703,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "ext-tokenizer": "*", @@ -2403,7 +2758,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/366a4a0f2b971fd43b7c351d621e8dd7d7131869", "reference": "366a4a0f2b971fd43b7c351d621e8dd7d7131869", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "doctrine/instantiator": "^1.2.0", @@ -2486,7 +2847,13 @@ "type": "zip", "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.3.0" @@ -2535,7 +2902,13 @@ "type": "zip", "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.3.0" @@ -2585,7 +2958,13 @@ "type": "zip", "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.3.0" @@ -2633,7 +3012,13 @@ "type": "zip", "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", "reference": "120b605dfeb996808c31b6477290a714d356e822", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.6" @@ -2673,7 +3058,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^5.6 || ^7.0" @@ -2718,7 +3109,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1", @@ -2782,7 +3179,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1" @@ -2838,7 +3241,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404", "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1" @@ -2891,7 +3300,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.0", @@ -2958,7 +3373,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.2", @@ -3012,7 +3433,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.0", @@ -3059,7 +3486,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", "reference": "773f97c67f28de00d397be301821b06708fca0be", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.0" @@ -3104,7 +3537,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.0" @@ -3157,7 +3596,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1" @@ -3199,7 +3644,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3", "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.2" @@ -3245,7 +3696,13 @@ "type": "zip", "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.6" @@ -3288,7 +3745,13 @@ "type": "zip", "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a", "reference": "5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "egulias/email-validator": "~2.0", @@ -3350,7 +3813,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/browser-kit/zipball/78b7611c45039e8ce81698be319851529bf040b1", "reference": "78b7611c45039e8ce81698be319851529bf040b1", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1.3", @@ -3409,7 +3878,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/console/zipball/929ddf360d401b958f611d44e726094ab46a7369", "reference": "929ddf360d401b958f611d44e726094ab46a7369", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1.3", @@ -3484,7 +3959,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/css-selector/zipball/f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9", "reference": "f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1.3" @@ -3537,7 +4018,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/e9f7b4d19d69b133bd638eeddcdc757723b4211f", "reference": "e9f7b4d19d69b133bd638eeddcdc757723b4211f", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1.3", @@ -3598,7 +4085,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/6229f58993e5a157f6096fc7145c0717d0be8807", "reference": "6229f58993e5a157f6096fc7145c0717d0be8807", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1.3", @@ -3668,7 +4161,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/c43ab685673fb6c8d84220c77897b1d6cdbe1d18", "reference": "c43ab685673fb6c8d84220c77897b1d6cdbe1d18", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1.3" @@ -3726,7 +4225,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/finder/zipball/5e575faa95548d0586f6bedaeabec259714e44d1", "reference": "5e575faa95548d0586f6bedaeabec259714e44d1", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1.3" @@ -3775,7 +4280,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", "reference": "550ebaac289296ce228a706d0867afc34687e3f4", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.3.3" @@ -3833,7 +4344,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/polyfill-iconv/zipball/685968b11e61a347c18bf25db32effa478be610f", "reference": "685968b11e61a347c18bf25db32effa478be610f", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.3.3" @@ -3892,7 +4409,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6af626ae6fa37d396dc90a399c0ff08e5cfc45b2", "reference": "6af626ae6fa37d396dc90a399c0ff08e5cfc45b2", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.3.3", @@ -3954,7 +4477,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.3.3" @@ -4013,7 +4542,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/04ce3335667451138df4307d6a9b61565560199e", "reference": "04ce3335667451138df4307d6a9b61565560199e", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.3.3" @@ -4068,7 +4603,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/2ceb49eaccb9352bff54d22570276bb75ba4a188", "reference": "2ceb49eaccb9352bff54d22570276bb75ba4a188", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.3.3" @@ -4126,7 +4667,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/process/zipball/50556892f3cc47d4200bfd1075314139c4c9ff4b", "reference": "50556892f3cc47d4200bfd1075314139c4c9ff4b", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1.3" @@ -4175,7 +4722,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffcde9615dc5bb4825b9f6aed07716f1f57faae0", "reference": "ffcde9615dc5bb4825b9f6aed07716f1f57faae0", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1.3", @@ -4233,7 +4786,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/yaml/zipball/41e16350a2a1c7383c4735aa2f9fce74cf3d1178", "reference": "41e16350a2a1c7383c4735aa2f9fce74cf3d1178", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.1.3", @@ -4292,7 +4851,13 @@ "type": "zip", "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "ext-dom": "*", @@ -4332,7 +4897,13 @@ "type": "zip", "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4", "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^5.3.3 || ^7.0", @@ -4382,7 +4953,13 @@ "type": "zip", "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/80bf3a6e04a0128f753cb73ba7255d8e2ae3a02f", "reference": "80bf3a6e04a0128f753cb73ba7255d8e2ae3a02f", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "bower-asset/inputmask": "~3.2.2 | ~3.3.5", @@ -4482,7 +5059,13 @@ "type": "zip", "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/073c9ab0a4eb71f2485d84c96a1967130300d8fc", "reference": "073c9ab0a4eb71f2485d84c96a1967130300d8fc", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "bower-asset/bootstrap": "3.4.* | 3.3.* | 3.2.* | 3.1.*", @@ -4545,7 +5128,13 @@ "type": "zip", "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/5c7ca9836cf80b34db265332a7f2f8438eb469b9", "reference": "5c7ca9836cf80b34db265332a7f2f8438eb469b9", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "composer-plugin-api": "^1.0" @@ -4588,6 +5177,63 @@ ], "time": "2019-07-16T13:22:30+00:00" }, + { + "name": "yiisoft/yii2-imagine", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-imagine.git", + "reference": "8637f63ee2eb81b7fe1f4c0e16cc8cc474a68bae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-imagine/zipball/8637f63ee2eb81b7fe1f4c0e16cc8cc474a68bae", + "reference": "8637f63ee2eb81b7fe1f4c0e16cc8cc474a68bae", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "imagine/imagine": "^0.6 | ^0.7 | ^1.0", + "yiisoft/yii2": "~2.0.0" + }, + "require-dev": { + "phpunit/phpunit": "<7" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\imagine\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Antonio Ramirez", + "email": "amigo.cobos@gmail.com" + } + ], + "description": "The Imagine integration for the Yii framework", + "keywords": [ + "helper", + "image", + "imagine", + "yii2" + ], + "time": "2019-06-04T12:38:50+00:00" + }, { "name": "yiisoft/yii2-swiftmailer", "version": "2.1.2", @@ -4600,7 +5246,13 @@ "type": "zip", "url": "https://api.github.com/repos/yiisoft/yii2-swiftmailer/zipball/09659a55959f9e64b8178d842b64a9ffae42b994", "reference": "09659a55959f9e64b8178d842b64a9ffae42b994", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "swiftmailer/swiftmailer": "~6.0", @@ -4652,7 +5304,13 @@ "type": "zip", "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/f72816b43e74063c8b10357394b6bba8cb1c10de", "reference": "f72816b43e74063c8b10357394b6bba8cb1c10de", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^5.3.3 || ^7.0" @@ -4702,7 +5360,13 @@ "type": "zip", "url": "https://api.github.com/repos/opis/closure/zipball/60a97fff133b1669a5b1776aa8ab06db3f3962b7", "reference": "60a97fff133b1669a5b1776aa8ab06db3f3962b7", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^5.4 || ^7.0" @@ -4763,7 +5427,13 @@ "type": "zip", "url": "https://api.github.com/repos/phpspec/php-diff/zipball/0464787bfa7cd13576c5a1e318709768798bec6a", "reference": "0464787bfa7cd13576c5a1e318709768798bec6a", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "type": "library", "extra": { @@ -4801,7 +5471,13 @@ "type": "zip", "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/62679af3183c308c0edffecc69778afc32ae55aa", "reference": "62679af3183c308c0edffecc69778afc32ae55aa", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "ext-mbstring": "*", @@ -4859,7 +5535,13 @@ "type": "zip", "url": "https://api.github.com/repos/yiisoft/yii2-faker/zipball/3df62b1dcb272a8413f9c6e532c9d73f325ccde1", "reference": "3df62b1dcb272a8413f9c6e532c9d73f325ccde1", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "fzaninotto/faker": "~1.4", @@ -4906,7 +5588,13 @@ "type": "zip", "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/cf3e81953a9e9796eed4021f3065bc5c18ee3356", "reference": "cf3e81953a9e9796eed4021f3065bc5c18ee3356", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "phpspec/php-diff": "^1.1.0", diff --git a/frontend/controllers/BaseController.php b/frontend/controllers/BaseController.php index bf90dc0..23d54a5 100644 --- a/frontend/controllers/BaseController.php +++ b/frontend/controllers/BaseController.php @@ -61,7 +61,7 @@ class BaseController extends \yii\web\Controller $log_info->remark = $info; $log_info->info = ''; if(!$log_info->save()) { - var_dump($log_info->errors); + throw new \Exception(print_r($log_info->getErrors(), true)); } } public function addNonLog($non_id,$info,$type) diff --git a/frontend/controllers/CarController.php b/frontend/controllers/CarController.php index 3833710..23b1e7a 100644 --- a/frontend/controllers/CarController.php +++ b/frontend/controllers/CarController.php @@ -65,6 +65,7 @@ use common\models\InvalidRenewal; use common\models\ZhongjiGiftT; use Yii; use yii\data\Pagination; +use yii\db\Exception; use yii\web\Response; class CarController extends BaseController @@ -404,37 +405,11 @@ class CarController extends BaseController $info = new CarT(); } $car_use_items = CarUseT::find()->all(); - $car_type_items = CarTypeT::find()->all(); - $brand_items = Brand2T::find()->all(); - $factory_items = FactoryT::find() - ->where('brand_id='.intval($info->brand_id)) - ->all(); - $series_items = Series2T::find() - ->where('factory_id='.intval($info->factory_id)) - ->all(); - $displacement_items = Displacement2T::find() - ->where('series_id='.intval($info->series_id)) - ->all(); - $year_items = YearT::find() - ->where('series_id='.intval($info->series_id.' and displacement_id='.intval($info->displacement_id))) - ->all(); - $model_items = ModelT::find() - ->where('series_id='.intval($info->series_id)) - ->andWhere('displacement_id='.intval($info->displacement_id)) - ->andWhere('year_id='.intval($info->year_id)) - ->all(); return $this->render('edit',[ 'user_id' => $user_id, 'info' => $info, 'car_use_items' => $car_use_items, - 'car_type_items' => $car_type_items, - 'brand_items' => $brand_items, - 'factory_items' => $factory_items, - 'series_items' => $series_items, - 'displacement_items' => $displacement_items, - 'year_items' => $year_items, - 'model_items' => $model_items, 'back_params' => $back_params ]); } @@ -454,26 +429,14 @@ class CarController extends BaseController $car_frame_no = $request->post('car_frame_no'); $factory_model = $request->post('factory_model'); $seats = $request->post('seats'); - $car_type_id = $request->post('car_type_id'); $car_use_id = $request->post('car_use_id'); $register_date = $request->post('register_date'); - $car_year = $request->post('car_year'); - $brand_id = $request->post('brand_id',0); - $factory_id = $request->post('factory_id',0); - $series_id = $request->post('series_id',0); - $displacement_id = $request->post('displacement_id',0); - $year_id = $request->post('year_id',0); - $model_id = $request->post('model_id',0); $car_man = $request->post('car_man'); + $car_man_type = $request->post('car_man_type'); $phone = $request->post('phone'); $car_man_number = $request->post('car_man_number'); - $insurer1_date = $request->post('insurer1_date'); - $insurer2_date = $request->post('insurer2_date'); - $company = $request->post('company'); + $purchase_price = $request->post('purchase_price'); $remark = $request->post('remark'); - $op_user1 = $request->post('op_user1'); - $op_user2 = $request->post('op_user2'); - $op_user3 = $request->post('op_user3'); if($car_no == '') { $result['msg'] = '请输入车牌号码!'; @@ -498,30 +461,18 @@ class CarController extends BaseController $row->factory_model = $factory_model; $row->car_model = $factory_model; $row->seats = $seats; - $row->car_type_id = $car_type_id; + $row->purchase_price = $purchase_price; $row->car_use_id = $car_use_id; $row->register_date = $register_date; - $row->car_year = $car_year; - $row->brand_id = $brand_id; - $row->factory_id = $factory_id; - $row->series_id = $series_id; - $row->displacement_id = $displacement_id; - $row->year_id = $year_id; - $row->model_id = $model_id; $row->car_man = $car_man; $row->phone = $phone; $row->car_man_number = $car_man_number; $row->remark = $remark; - if($insurer1_date != '') - $row->insurer1_date = $insurer1_date; - if($insurer2_date != '') - $row->insurer2_date = $insurer2_date; - if($company != '') - $row->company = $company; - $row->op_user1 = $op_user1; - $row->op_user2 = $op_user2; - $row->op_user3 = $op_user3; - $row->save(); + $row->car_man_type = $car_man_type; + if(!$row->save()) { + $result['msg'] = print_r($row->getErrors(), true); + return $result; + } $result['success'] = true; $result['msg'] = '保存成功'; @@ -774,12 +725,8 @@ class CarController extends BaseController $failure_items = InvalidT::getTreeXinbaoNew(2); $list = MeetT::getAllData(1); - - $business_group = BusinessGroupT::find()->all(); - $order_ad=OrderAddress::findOne(['id'=>$order_info->addr_id]); - //非车险方案表 $province = Region::find()->asArray()->where(['parent_id'=>0])->andWhere(['level'=>1])->all(); $c=[]; @@ -791,6 +738,7 @@ class CarController extends BaseController ->all(); return $this->render('info',[ + 'user_id' => $this->my->id, 'car_info' => $car_info, 'link_men' => $linkMan_items, 'insurer_type_items' => $insurer_type_items, @@ -815,7 +763,7 @@ class CarController extends BaseController 'city' =>$c, 'district' =>$d, 'twon' =>isset($e)?$e:[], - 'order_ad' =>isset($order_ad)?$order_ad:[], + 'order_ad' =>isset($order_ad)?$order_ad:[] ]); } /* @@ -978,10 +926,14 @@ class CarController extends BaseController } public function actionInfoTrack() { - if($this->my->role_id<5){ - return $this->render('info-track-edit'); - } - return $this->render('info-track-info'); + $request = Yii::$app->request; + $id = $request->get('id',0); + // 车辆信息 + $car_info = CarT::findOne(['id'=>$id]); + + return $this->render('info-track',[ + 'car_info' => $car_info + ]); } public function actionInfoTrackJson() @@ -1019,6 +971,17 @@ class CarController extends BaseController // 无效数据 $failure_items = InvalidT::getTrees(); + //新礼品 + $query = GiftTicketT::find() + ->orderBy('id DESC'); + $items = $query->andWhere('car_no like "'.$car_info->car_no.'"')->all(); + + //旧礼品 + $gift_items = CarGiftT::find() + ->where('car_id='.$car_info->id) + ->orderBy('strategy_id DESC') + ->all(); + //下一辆 $next_id = 0; if($type == 1) { // 首发 预约时间小于当前 @@ -1105,132 +1068,40 @@ class CarController extends BaseController $list = MeetT::getAllData(2); + //登陆用户ID + $uid = $this->my->role_id; + $aid = $this->my->id; + //获取业务分组 $business_group = BusinessGroupT::find()->all(); - // 处理车辆信息 - $car_info_arr = $car_info->toArray(); - $car_info_arr['brand_txt'] = $car_info->brand ? $car_info->brand->name : ''; - $car_info_arr['car_type_txt'] = $car_info->carType ? $car_info->carType->name : ''; - $car_info_arr['car_use_txt'] = $car_info->carUse ? $car_info->carUse->name : ''; - $car_info_arr['car_use_txt'] = $car_info->carUse ? $car_info->carUse->name : ''; - $car_info_arr['series_txt'] = $car_info->series ? $car_info->series->name : ''; - $car_info_arr['displacement_txt'] = $car_info->displacement ? $car_info->displacement->name : ''; - $car_info_arr['location_txt'] = $car_info->location == 3 ? '本区' : ($car_info->location == 6 ? '外区' : '未知'); - - // 操作记录 - return MyLib::ok3([ - 'type' => $type, // 预约类型(首发,预约时间) - 'can_cancel' => $this->canCancelAppointment($car_info->insurer1_date,$car_info->insurer2_date), - 'car_man' => $car_man, // 车主 - 'car_no' => $car_no, // 车牌号 - 'phone' => $phone, // 电话 - - 'car_info' => $car_info_arr, // 车辆信息 - 'car_use_info' => $car_use_items, // 运营性质 - 'car_type_info' => $car_type_items, // 车辆类型 - 'brand_info' => $brand_items, // 品牌信息 - 'series_info' => $series_items, // 车系信息 - 'displacement_info' => $displacement_items, // 排量信息 - - 'invalid_info' => $failure_items, // 无效数据 - 'appointment_type_info' => $list, // 预约类型 - 'business_group_info' => $business_group, // 业务分组 - - 'next_id' => $next_id, // 下一条信息ID - 'next_index' => $next_index, // 下一条偏移 + 'type' => $type, + 'car_info' => $car_info, + 'failure_info' => $failure_items, + 'next_id' => $next_id, + 'appointment_type' => $list, + 'new_gift_info' => $items, + 'old_gift_info' => $gift_items, + 'uid' => $uid, + 'next_index' => $next_index, + 'car_man' => $car_man, + 'car_no' => $car_no, + 'phone' => $phone, 'page' => $page, 'sort_key' => $sort_key, 'sort_value' => $sort_value, - + 'car_use_items' => $car_use_items, + 'car_type_items' => $car_type_items, + 'brand_items' => $brand_items, + 'series_items' => $series_items, + 'displacement_items' => $displacement_items, 'back_params' => $back_params, + 'business_group' => $business_group, + 'adid' => $aid, ]); } - public function actionInfoTrackTableJson(){ - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $car_id = $request->get('car_id',0); - $car_no = $request->get('car_no',''); - $name = $request->get('name',0); - $offset = $request->get('offset',0); - $limit = $request->get('limit', 10); - switch ($name){ - case 'insurer_order': - $query = OrderT::find(); - $map = ['=', 'car_id', $car_id]; - $order = [ - 'print_date' => SORT_DESC, - 'id' => SORT_DESC, - ]; - break; - case 'new_gift': - $query = GiftTicketT::find(); - $map = ['like', 'car_no', $car_no]; - $order = [ - 'id' => SORT_DESC, - ]; - break; - case 'old_gift': - $query = CarGiftT::find(); - $map = ['=', 'car_id', $car_id]; - $order = [ - 'strategy_id' => SORT_DESC, - ]; - break; - case 'car_history': - $query = CarLogT::find(); - $map = ['and',['=', 'car_id', $car_id]]; - if($this->my->id <= 2){ - $map[] = ['>=', 'op_time', strtotime("-6 months")]; - } - $order = [ - 'op_time' => SORT_DESC, - ]; - break; - default: - return MyLib::error3('name参数错误'); - } - - $query = $query->where($map)->orderBy($order); - $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(); - switch ($name){ - case 'insurer_order': - $row['show_name'] = $item->user ? $item->user->getShowName() : ''; - $row['status_txt'] = $item->status ? $item->status->name : ''; - break; - case 'new_gift': - $row['type_txt'] = $item->type ? $item->type->name : ''; - $row['show_name'] = $item->user ? $item->user->getShowName() : ''; - $row['status_txt'] = $item->status ? $item->getStatus() : ''; - break; - case 'old_gift': - $row['name'] = $item->gift->name; - $row['type_txt'] = $item->gift->getShowType(); - $row['remark'] = $item->gift->remark; - $row['strategy_txt'] = $item->strategy_id > 0 ? '公司礼品' : '自费礼品'; - $row['show_name'] = $item->user ? $item->user->getShowName() : ''; - $row['status_txt'] = $item->status ? $item->getStatus() : ''; - $row['submit_time_txt'] = date('Y-m-d H:i:s', $item->submit_time); - break; - case 'car_history': - $row['op_time_txt'] = date('Y-m-d H:i:s', $item->op_time); - break; - } - $data['rows'][] = $row; - } - return $data; - } - public function actionInfoTrackFix() { $request = Yii::$app->request; @@ -1389,248 +1260,6 @@ class CarController extends BaseController ]); } - -// public function actionInfoRenewal() -// { -// $request = Yii::$app->request; -// $id = $request->get('id',0); -// $type = $request->get('type',0); -// $car_man = $request->get('car_man'); -// $phone = $request->get('phone'); -// $car_no = $request->get('car_no'); -// $page = $request->get('page',1); -// $sort_key = $request->get('sort_key','appointment_t.pdate'); -// $sort_value = $request->get('sort_value','ASC'); -// $next_index = $request->get('next_index',0); -// $back_params = $request->get('back_params'); -// $my_path = $this->my->group?$this->my->group->getPath():''; -// -// $car_info = CarT::findOne(['id'=>$id]); -// $order_info = $car_info->getOrders()->orderBy('id DESC')->one(); -// if(!$order_info) { -// $user_id = 0; -// if($car_info->location == 2) { -// $b_info = CarBT::findOne(['id'=>$car_info->id]); -// $user_id = $b_info->user_id; -// } -// if($car_info->location == 3) { -// $c_info = CarCT::findOne(['id'=>$car_info->id]); -// $user_id = $c_info->user_id; -// } -// if($car_info->location == 4) { -// $d_info = CarDT::findOne(['id'=>$car_info->id]); -// $user_id = $d_info->user_id; -// } -// $order_info = new OrderT(); -// $order_info->car_id = $car_info->id; -// $order_info->car_no = $car_info->car_no; -// $order_info->engine_no = $car_info->engine_no; -// $order_info->car_frame_no = $car_info->car_frame_no; -// $order_info->car_man = $car_info->car_man; -// $order_info->user_id = $user_id; -// $order_info->status_id = 1; -// $order_info->id_man = $car_info->car_man; -// $order_info->link_man = $car_info->car_man; -// $order_info->link_phone = $car_info->phone; -// $order_info->save(); -// } -// $insurer_type_items = InsurerTypeT::find()->all(); -// $insurer_company_items = InsurerCompanyT::find()->all(); -// $insurer_company2_items = InsurerCompany2T::find()->all(); -// $pay_type_items = PayTypeT::find()->all(); -// $car_use_items = CarUseT::find()->all(); -// $car_type_items = CarTypeT::find()->all(); -// $brand_items = BrandT::find()->all(); -// $series_items = SeriesT::find() -// ->where('brand_id='.intval($car_info->brand_id)) -// ->all(); -// $displacement_items = DisplacementT::find() -// ->where('series_id='.intval($car_info->series_id)) -// ->all(); -// $direction_items = DirectionT::find() -// ->all(); -// $range_items = RangeT::find() -// ->all(); -// $city_items = CityT::find() -// ->all(); -// $district_items = DistrictT::find() -// ->orderBy('order_id ASC') -// ->all(); -// $gift_items = GiftT::find() -// ->where('type_id=1') -// ->all(); -// $success_items = InvalidT::getTree(1); -// $failure_items = InvalidT::getTreeXubao(2); -// -// //下一辆 -// $next_id = 0; -// if($type == 1) { -// $query = AppointmentT::find() -// ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') -// ->where('appointment_t.is_first=1 and car_t.location=4') -// ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"'); -// -// $user_ids = $this->getChildrenUserIDs(); -// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); -// -// if($car_man != '') { -// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('car_t.phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); -// } -// if($sort_key != '') { -// $query = $query->orderBy($sort_key.' '.$sort_value); -// } -// $next_item = $query->offset($next_index)->one(); -// if($next_item) { -// $next_id = $next_item->car_id; -// } -// $next_index++; -// } -// if($type == 2) { -// $query = AppointmentT::find() -// ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') -// ->where('appointment_t.is_first=0 and car_t.location=4') -// ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"'); -// -// $user_ids = $this->getChildrenUserIDs(); -// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); -// -// if($car_man != '') { -// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('car_t.phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); -// } -// if($sort_key != '') { -// $query = $query->orderBy($sort_key.' '.$sort_value); -// } -// $next_item = $query->offset($next_index)->one(); -// if($next_item) { -// $next_id = $next_item->car_id; -// } -// $next_index++; -// } -// if($type == 3) { -// $query = AppointmentT::find() -// ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') -// ->where('appointment_t.is_first=0 and car_t.location=4'); -// -// $user_ids = $this->getChildrenUserIDs(); -// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]); -// -// if($car_man != '') { -// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('car_t.phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"'); -// } -// if($sort_key != '') { -// $query = $query->orderBy($sort_key.' '.$sort_value); -// } -// $next_item = $query->offset($next_index)->one(); -// if($next_item) { -// $next_id = $next_item->car_id; -// } -// $next_index++; -// } -// if($type == 4) { -// $query = OrderT::find() -// ->where('status_id=1 and return_status_id>0') -// ->orderBy('submit_date DESC, id DESC'); -// $user_items = $this->my->getChildren(); -// $user_ids[] = $this->my->id; -// if($user_items) { -// foreach($user_items as $user_item) { -// $user_ids[] = $user_item->id; -// } -// } -// $query = $query->andWhere(['in','user_id',$user_ids]); -// if($car_man != '') { -// $query = $query->andWhere('car_man="'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('link_phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_no="'.$car_no.'"'); -// } -// $next_item = $query->offset($next_index)->one(); -// if($next_item) { -// $next_id = $next_item->car_id; -// } -// $next_index++; -// } -// -//// $gift_type_items = GiftType2T::find()->all(); -// $gift_group_items = GiftGroupT::find() -// ->where('is_free=0') -// ->all(); -// $gift_free_group_items = GiftGroupT::find() -// ->where('is_free=1') -// ->all(); -// //获取礼品数据 -// $sel_gifts = array(); -// $tmp_items = OrderGiftT::find() -// ->where('order_id='.$order_info->id) -// ->all(); -// foreach($tmp_items as $item) { -// $sel_gifts[$item->group_id] = $item; -// } -// -// $list = MeetT::getAllData(1); -// -// $business_group = BusinessGroupT::find()->all(); -// -// return $this->render('info-renewal',[ -// 'type' => $type, -// 'car_info' => $car_info, -// 'insurer_type_items' => $insurer_type_items, -// 'order_info' => $order_info, -// 'insurer_company_items' => $insurer_company_items, -// 'insurer_company2_items' => $insurer_company2_items, -// 'pay_type_items' => $pay_type_items, -// 'car_use_items' => $car_use_items, -// 'car_type_items' => $car_type_items, -// 'brand_items' => $brand_items, -// 'series_items' => $series_items, -// 'displacement_items' => $displacement_items, -// 'direction_items' => $direction_items, -// 'range_items' => $range_items, -// 'city_items' => $city_items, -// 'district_items' => $district_items, -// 'gift_items' => $gift_items, -// 'success_items' => $success_items, -// 'failure_items' => $failure_items, -// 'next_id' => $next_id, -// 'list' => $list, -// 'next_index' => $next_index, -// 'car_man' => $car_man, -// 'car_no' => $car_no, -// 'phone' => $phone, -// 'page' => $page, -// 'sort_key' => $sort_key, -// 'sort_value' => $sort_value, -// 'back_params' => $back_params, -//// 'gift_type_items' => $gift_type_items, -// 'gift_group_items' => $gift_group_items, -// 'gift_free_group_items' => $gift_free_group_items, -// 'sel_gifts' => $sel_gifts, -// 'my_path' => $my_path, -// 'business_group' => $business_group, -// 'business_group_id' => $this->my->business_group_id, -// ]); -// } public function actionInfoRenewal() { $request = Yii::$app->request; @@ -2374,6 +2003,10 @@ class CarController extends BaseController $seats = (int)$request->post('seats'); $register_date = $request->post('register_date'); $car_use_id = $request->post('car_use_id'); + $purchase_price = $request->post('purchase_price'); + $car_frame_no = $request->post('car_frame_no'); + $engine_no = $request->post('engine_no'); + $factory_model = $request->post('factory_model'); //策略信息 $celuo_id = $request->post('celuo_id'); @@ -2394,6 +2027,7 @@ class CarController extends BaseController $link_man_number = $request->post('link_man_number'); $link_man_type = $request->post('link_man_type'); $link_man_phone = $request->post('link_man_phone'); + $pay_type_id = $request->post('pay_type_id'); //送单地址信息 $send_district_id = $request->post('send_district_id'); @@ -2403,12 +2037,10 @@ class CarController extends BaseController //保单信息 $order_id = $request->post('id', 0); $email = $request->post('email'); - $send_date = $request->post('send_date'); - $company2_id = $request->post('company2_id'); + $company_id = $request->post('company_id'); $insurer1_begin_date = $request->post('insurer1_begin_date'); $insurer2_begin_date = $request->post('insurer2_begin_date'); $order_remark = $request->post('order_remark'); - $success_id = $request->post('success_id'); //报价信息 $total1_clear = $request->post('total1_clear'); @@ -2460,8 +2092,13 @@ class CarController extends BaseController $car_info->seats = $seats; $car_info->register_date = $register_date; $car_info->car_man = $car_man; + $car_info->car_man_number = $car_man_number; $car_info->car_use_id = $car_use_id; + $car_info->engine_no = $engine_no; + $car_info->car_frame_no = $car_frame_no; + $car_info->factory_model = $factory_model; + $car_info->purchase_price = $purchase_price; if(!$car_info->save()) { throw new \Exception(print_r($car_info->getErrors(), true)); } @@ -2469,8 +2106,10 @@ class CarController extends BaseController //保单信息 $order_info->car_no = $car_no; $order_info->seats = $seats; - $order_info->engine_no = $car_info->engine_no; - $order_info->car_frame_no = $car_info->car_frame_no; + $order_info->engine_no = $engine_no; + $order_info->car_frame_no = $car_frame_no; + $order_info->factory_model = $factory_model; + $order_info->purchase_price = $purchase_price; $order_info->car_man = $car_man; $order_info->car_man_phone = $car_man_phone; $order_info->car_man_type = $car_man_type; @@ -2484,7 +2123,7 @@ class CarController extends BaseController $order_info->link_man_type = $link_man_type; $order_info->link_man_number = $link_man_number; - $order_info->company2_id = $company2_id; + $order_info->company_id = $company_id; if($order_info->status_id != $status_id) { if($order_info->return_status_id > 0) { $order_info->status_id = $order_info->return_status_id; @@ -2495,18 +2134,20 @@ class CarController extends BaseController } } $order_info->submit_date = date('Y-m-d'); + //商业保险日期 $order_info->insurer1_begin_date = $insurer1_begin_date; $insurer1_end_date = ''; if ($insurer1_begin_date != '') { $insurer1_end_date = date('Y-m-d', strtotime(date('Y-m-d', strtotime($insurer1_begin_date . "+1 year")) . '-1 day')); } $order_info->insurer1_end_date = $insurer1_end_date; + //交强保险日期 $order_info->insurer2_begin_date = $insurer2_begin_date; $insurer2_end_date = ''; if ($insurer2_begin_date != '') $insurer2_end_date = date('Y-m-d', strtotime(date('Y-m-d', strtotime($insurer2_begin_date . "+1 year")) . '-1 day')); $order_info->insurer2_end_date = $insurer2_end_date; - $order_info->send_date = $send_date; + $order_info->send_district_id = $send_district_id; $order_info->send_city_id = $send_city_id; $order_info->send_address = $send_address; @@ -2525,6 +2166,7 @@ class CarController extends BaseController $order_info->total_real = $total_real; $order_info->price_remark = $price_remark; $order_info->yuangong_money = $yuangong_money; + $order_info->pay_type_id = $pay_type_id; $order_info->money_man = $money_man; $order_info->money_bank = $money_bank; @@ -2568,9 +2210,10 @@ class CarController extends BaseController } //处理预约 + $result['msg'] = '保存成功'; if ($status_id > 1) { $tmp_row = AppointmentT::findOne(['car_id' => $car_info->id]); - if (!empty($tmp_row)) { + if($tmp_row) { $tmp_row->delete(); } $tmp_status_info = StatusT::findOne(['id' => $status_id]); @@ -2579,9 +2222,9 @@ class CarController extends BaseController $log_msg = '进入' . $tmp_status_info->name; } $this->addLog($car_info->id, $log_msg, 1); + $result['msg'] = '提交成功'; } - // 处理财务-如果是在线支付-生成财务分支 - + // 处理财务-如果是在线支付-生成财务分支-返现记录 if ($status_id > 1) { $order_caiwu = OrderCaiwuT::findOne(['order_id'=>$order_info->id]); @@ -2600,6 +2243,7 @@ class CarController extends BaseController } //处理策略 + $gift_counts = []; OrderGiftT::deleteAll('order_id=' . $order_info->id . ' and status=0'); //礼品 foreach($gift_ids as $gift_str) { @@ -2621,6 +2265,15 @@ class CarController extends BaseController if (!$row->save()) { throw new \Exception(print_r($row->getErrors(), true)); } + if(!isset($gift_counts[$zhongjigift_item->id])) { + $gift_counts[$zhongjigift_item->id] = 1; + } else { + $gift_counts[$zhongjigift_item->id] += 1; + } + if($gift_counts[$zhongjigift_item->id] > $zhongjigift_item->n) { + $result['msg'] = '礼品数量超限,请重新选择'; + return $result; + } } } //礼券 @@ -2643,11 +2296,19 @@ class CarController extends BaseController if (!$row->save()) { throw new \Exception(print_r($row->getErrors(), true)); } + if(!isset($gift_counts[$zhongjigift_item->id])) { + $gift_counts[$zhongjigift_item->id] = 1; + } else { + $gift_counts[$zhongjigift_item->id] += 1; + } + if($gift_counts[$zhongjigift_item->id] > $zhongjigift_item->n) { + $result['msg'] = '礼券数量超限,请重新选择'; + return $result; + } } } $result['success'] = true; - $result['msg'] = '保存成功'; $tran->commit(); } catch (\Exception $e) { @@ -2694,34 +2355,6 @@ class CarController extends BaseController $result['html'] = $html; return $result; } - - public function actionAjaxHistoryIndexJson() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $car_id = $request->get('car_id'); - $offset = $request->get('offset',0); - $limit = $request->get('limit', 10); - - $result = array(); - $result['success'] = false; - $result['msg'] = '读取失败'; - - $query = CarLogT::find() - ->where(['car_id'=>$car_id,'type'=>1]) - ->andWhere('op_time>='.strtotime("-6 months")) - ->orderBy('op_time DESC'); - - $total = $query->count(); - - $query = $query->offset($offset)->limit($limit); - $items = $query->all(); - - $result['success'] = true; - $result['msg'] = '读取成功'; - $result['data'] = MyLib::GetInfosResponse('history',$items); - return $result; - } public function actionAjaxHistoryIndexXubao() { Yii::$app->response->format = Response::FORMAT_JSON; @@ -4517,383 +4150,15 @@ class CarController extends BaseController ]); } -// public function actionSmsMake() -// { -// Yii::$app->response->format = Response::FORMAT_JSON; -// $request = Yii::$app->request; -// $result = array(); -// $result['success'] = false; -// $result['msg'] = '生成失败'; -// -// $order_id = $request->post('order_id'); -// $order_info = OrderT::findOne(['id'=>$order_id]); -// $car_info = $order_info->car; -// -// $total1 = $request->post('total1'); -// $total2 = $request->post('total2'); -// $total3 = $request->post('total3'); -// $total_all = $request->post('total_all'); -// $total_real = $request->post('total_real'); -// $types = $request->post('types'); -// $nopays = $request->post('nopays'); -// -// $insurer_type_items = InsurerTypeT::find()->all(); -// -//// 之前的生成短信内容 -//// $msg = '尊敬的'.$car_info->car_no.'客户您好,人保车险'.$this->my->name.'为您报价:'; -//// $msg .= '交强险'.$total2.'元,'; -//// $msg .= '商业险'.$total1.'元'; -//// $msg .= '(包含'; -//// $bj = ''; -//// foreach($insurer_type_items as $item) { -//// if($item->id == 10 || $item->id == 11) continue; -//// if($types[$item->id] != '' && $types[$item->id] != '否' && $types[$item->id] != '无') { -//// $msg .= $item->name; -//// if($types[$item->id] != '是') -//// $msg .= $types[$item->id]; -//// $msg .= '、'; -//// if(isset($nopays[$item->id]) && ($nopays[$item->id] == 1)) -//// $bj .= $item->code; -//// } -//// } -//// if($bj != '') { -//// $msg .= '不计免赔覆盖'.$bj.'),'; -//// } -//// if($total3 > 0) { -//// $msg .= '车船税'.$total3.'元,'; -//// } -//// $msg .= '发票金额:'.$total_all.'元,'; -//// $msg .= '实收:'.$total_real.'元,'; -//// $msg .= '以上价格仅供参考,价格可能受您的历史理赔情况等的影响,最终价格以出单为准。详情请咨询010-53778188,回复TD拒收。'; -// -// //新的生成短信 -// $msg = '您好,中国人保车险'.$this->my->name.'(工号'.$this->my->username.'), 您的'.$car_info->car_no.':'; -// $msg .= '交强险'.$total2.'元,'; -// if($total3 > 0) { -// $msg .= '车船'.$total3.'元,'; -// } -// $msg .= '商业险'.$total1.'元,'; -// $msg .= '总计'.($total_all).'元,'; -// $msg .= '实收:'.($total_real).'元,'; -// $msg .= '(含'; -// $bj = ''; -// foreach($insurer_type_items as $item) { -// if($item->id == 10 || $item->id == 11) continue; -// if($types[$item->id] != '' && $types[$item->id] != '否' && $types[$item->id] != '无') { -// $msg .= $item->name; -// if($types[$item->id] != '是') -// $msg .= $types[$item->id]; -// $msg .= '、'; -// if(isset($nopays[$item->id]) && ($nopays[$item->id] == 1)) -// $bj .= $item->code; -// } -// } -// if($bj != '') { -// $msg .= '及相应不计免赔),'; -//// $msg .= '不计免赔覆盖'.$bj.'),'; -// } -// if($total1 < 1500){ -// $eleven = '7.(①进口3M封釉全车美容,②四轮定位动平衡,③二十二项全车检测,④保养100元工时抵用券,⑤内饰臭氧杀菌消毒);服务项目五选二'; -// $eight = '8.上门免费办理ETC'; -// $nine = null; -// }elseif($total1 >= 1500){ -// $eleven = '7.(①进口3M封釉全车美容,②四轮定位动平衡,③二十二项全车检测,④保养100元工时抵用券,⑤内饰臭氧杀菌消毒);服务项目五选二'; -// $eight = '8.上门免费办理ETC'; -// $nine = null; -// }else if($total1 >= 2000){ -// $eleven = '7.(①进口3M封釉全车美容,②四轮定位动平衡,③二十二项全车检测,④保养100元工时抵用券,⑤内饰臭氧杀菌消毒);服务项目五选二'; -// $eight = '8.上门免费办理ETC'; -// $nine = null; -// }else{ -// $eleven = '7.上门免费办理ETC'; -// $eight = null; -// $nine = null; -// } -// $msg .= '内含: -//1.客户经理一对一处理事故现场及理赔咨询 -//2.全程代办:上门接送车辆定损维修理赔一站式服务 -//3.一案多修(可维修四处车伤) -//4.单双方事故通定直赔,全程代办(可约代步车) -//5.全年24小时事故救援,非事故救援(搭电,送水,换备胎,拖车等) -//6.送单上门 -//'.$eleven.' -//'.$eight.' -//'.$nine.' -//您有任何问题请拨打'.$this->my->phone.',微信同号。祝您生活愉快! -//回复TD拒收'; -// -// $result['success'] = true; -// $result['msg'] = $msg; -// return $result; -// } - - - -// public function actionSmsMake() -// { -// Yii::$app->response->format = Response::FORMAT_JSON; -// $request = Yii::$app->request; -// $result = array(); -// $result['success'] = false; -// $result['msg'] = '生成失败'; -// -// $order_id = $request->post('order_id'); -// $order_info = OrderT::findOne(['id'=>$order_id]); -// $car_info = $order_info->car; -// -// $total1 = $request->post('total1'); -// $total2 = $request->post('total2'); -// -// $total1_clear = $request->post('total1_clear'); -// -// $total3 = $request->post('total3'); -// $total_all = $request->post('total_all'); -// $total_real = $request->post('total_real'); -// $types = $request->post('types'); -// $nopays = $request->post('nopays'); -// $total1_dis = $request->post('total1_dis'); -// -// $insurer_type_items = InsurerTypeT::find()->all(); -// -//// 之前的生成短信内容 -//// $msg = '尊敬的'.$car_info->car_no.'客户您好,人保车险'.$this->my->name.'为您报价:'; -//// $msg .= '交强险'.$total2.'元,'; -//// $msg .= '商业险'.$total1.'元'; -//// $msg .= '(包含'; -//// $bj = ''; -//// foreach($insurer_type_items as $item) { -//// if($item->id == 10 || $item->id == 11) continue; -//// if($types[$item->id] != '' && $types[$item->id] != '否' && $types[$item->id] != '无') { -//// $msg .= $item->name; -//// if($types[$item->id] != '是') -//// $msg .= $types[$item->id]; -//// $msg .= '、'; -//// if(isset($nopays[$item->id]) && ($nopays[$item->id] == 1)) -//// $bj .= $item->code; -//// } -//// } -//// if($bj != '') { -//// $msg .= '不计免赔覆盖'.$bj.'),'; -//// } -//// if($total3 > 0) { -//// $msg .= '车船税'.$total3.'元,'; -//// } -//// $msg .= '发票金额:'.$total_all.'元,'; -//// $msg .= '实收:'.$total_real.'元,'; -//// $msg .= '以上价格仅供参考,价格可能受您的历史理赔情况等的影响,最终价格以出单为准。详情请咨询010-53778188,回复TD拒收。'; -// -// //新的生成短信 -// $msg ='尊敬的'.$car_info->car_no.'客户您好:人保'.$this->my->name.'(工号'.$this->my->username.')为您报价:'; -//// $msg = '您好,中国人保车险'.$this->my->name.'(工号'.$this->my->username.'), 您的'.$car_info->car_no.':'; -// $msg .= '交强険'.$total2.'元,'; -// if($total3 > 0) { -// $msg .= '车船'.$total3.'元,'; -// } -// $msg .= '商业険'.$total1.'元,'; -// $msg .= '总计'.($total_all).'元,'; -// $msg .= '['; -// $bj = ''; -// foreach($insurer_type_items as $item) { -// if($item->id == 10 || $item->id == 11) continue; -// if($types[$item->id] != '' && $types[$item->id] != '否' && $types[$item->id] != '无') { -// $msg .= $item->name; -// if($types[$item->id] != '是') -// $msg .= $types[$item->id]; -// $msg .= '、'; -// if(isset($nopays[$item->id]) && ($nopays[$item->id] == 1)) -// $bj .= $item->code; -// } -// } -// if($bj != '') { -// $msg .= '不计免赔];'; -// } -//// if($total1_clear < 1000){ -//// $msg .= ' -////您有任何问题请拨打'.$this->my->phone.'联系我,微信同号。祝您生活愉快! -////回复TD拒收'; -//// -//// }else{ -//// if($total1_clear >= 1000 && $total1_clear < 2000){ -//// $eleven = '7.另有超值项目五选二'; -//// $eight = null; -//// $nine = null; -//// }else if($total1_clear >= 2000 && $total1_clear<3000){ -//// $eleven = '7.另有超值项目五选二'; -//// -//// $eight = null; -//// -//// $nine = null; -//// }else if($total1_clear >= 3000){ -//// -////// $eleven = '7.(1.一个部位车伤修复 (含钣金喷漆),2.免费小保养一次 3.整车无机镀晶一次)三选一'; -//// $eleven = '7.另有超值项目五选二'; -//// -//// $eight = null; -//// $nine = null; -//// }else{ -////// $eleven = '7.上门免费办理ETC'; -//// $eleven = null; -//// $eight = null; -//// $nine = null; -//// } -// $msg .= '出单赠送赠送≥'.$total1.'元商业全额保单专享礼包: -//1.'.$total1_dis.'元现金红包 -//2.价值600-1000元升级礼券包(喷漆,保养,镀晶三选一) -//3.价值1200元超值美容包(外观美容封釉,内室臭氧杀菌,空调风道清洗三项) -//4.价值2000元VIP服务包(人伤极速赔、客户经理一对一、全程代办、双方事故直赔、一案多修、升级救援、代步车等15项理赔升级服务,附VIP客户车险服务权益书告知书一份) -//5.赠送470元全国通用体检套餐双人卡1份 -//短信字数有限,详询010-51669518或'.$this->my->phone.'联系我,微信同号。祝您生活愉快! -//回复TD拒收'; -//// } -// -// -// $result['success'] = true; -// $result['msg'] = $msg; -// return $result; -// } - -// public function actionSmsMake() -// { -// Yii::$app->response->format = Response::FORMAT_JSON; -// $request = Yii::$app->request; -// $result = array(); -// $result['success'] = false; -// $result['msg'] = '生成失败'; -// -// $order_id = $request->post('order_id'); -// $order_info = OrderT::findOne(['id'=>$order_id]); -// $car_info = $order_info->car; -// -// $total1 = $request->post('total1'); -// $total2 = $request->post('total2'); -// -// $total1_clear = $request->post('total1_clear'); -// -// $total3 = $request->post('total3'); -// $total_all = $request->post('total_all'); -// $total_real = $request->post('total_real'); -// $types = $request->post('types'); -// $nopays = $request->post('nopays'); -// $total1_dis = $request->post('total1_dis'); -// -// $insurer_type_items = InsurerTypeT::find()->all(); -// -// //保费15% -// $hongbao=$total1_clear * 0.15; -// -// -//// 之前的生成短信内容 -//// $msg = '尊敬的'.$car_info->car_no.'客户您好,人保车险'.$this->my->name.'为您报价:'; -//// $msg .= '交强险'.$total2.'元,'; -//// $msg .= '商业险'.$total1.'元'; -//// $msg .= '(包含'; -//// $bj = ''; -//// foreach($insurer_type_items as $item) { -//// if($item->id == 10 || $item->id == 11) continue; -//// if($types[$item->id] != '' && $types[$item->id] != '否' && $types[$item->id] != '无') { -//// $msg .= $item->name; -//// if($types[$item->id] != '是') -//// $msg .= $types[$item->id]; -//// $msg .= '、'; -//// if(isset($nopays[$item->id]) && ($nopays[$item->id] == 1)) -//// $bj .= $item->code; -//// } -//// } -//// if($bj != '') { -//// $msg .= '不计免赔覆盖'.$bj.'),'; -//// } -//// if($total3 > 0) { -//// $msg .= '车船税'.$total3.'元,'; -//// } -//// $msg .= '发票金额:'.$total_all.'元,'; -//// $msg .= '实收:'.$total_real.'元,'; -//// $msg .= '以上价格仅供参考,价格可能受您的历史理赔情况等的影响,最终价格以出单为准。详情请咨询010-53778188,回复TD拒收。'; -// -// -// //新的生成短信 -// $msg ='尊敬的'.$car_info->car_no.'客户您好:人保'.$this->my->name.'(工号'.$this->my->username.')为您报价:'; -//// $msg = '您好,中国人保车险'.$this->my->name.'(工号'.$this->my->username.'), 您的'.$car_info->car_no.':'; -// $msg .= '交强険'.$total2.'元,'; -// if($total3 > 0) { -// $msg .= '车船'.$total3.'元,'; -// } -// $msg .= '商业険'.$total1.'元,'; -// $msg .= '总计'.($total_all).'元,'; -// $msg .= '['; -// $bj = ''; -// foreach($insurer_type_items as $item) { -// if($item->id == 10 || $item->id == 11) continue; -// if($types[$item->id] != '' && $types[$item->id] != '否' && $types[$item->id] != '无') { -// $msg .= $item->name; -// if($types[$item->id] != '是') -// $msg .= $types[$item->id]; -// $msg .= '、'; -// if(isset($nopays[$item->id]) && ($nopays[$item->id] == 1)) -// $bj .= $item->code; -// } -// } -// if($bj != '') { -// $msg .= '不计免赔];'; -// } -//// if($total1_clear < 1000){ -//// $msg .= ' -////您有任何问题请拨打'.$this->my->phone.'联系我,微信同号。祝您生活愉快! -////回复TD拒收'; -//// -//// }else{ -//// if($total1_clear >= 1000 && $total1_clear < 2000){ -//// $eleven = '7.另有超值项目五选二'; -//// $eight = null; -//// $nine = null; -//// }else if($total1_clear >= 2000 && $total1_clear<3000){ -//// $eleven = '7.另有超值项目五选二'; -//// -//// $eight = null; -//// -//// $nine = null; -//// }else if($total1_clear >= 3000){ -//// -////// $eleven = '7.(1.一个部位车伤修复 (含钣金喷漆),2.免费小保养一次 3.整车无机镀晶一次)三选一'; -//// $eleven = '7.另有超值项目五选二'; -//// -//// $eight = null; -//// $nine = null; -//// }else{ -////// $eleven = '7.上门免费办理ETC'; -//// $eleven = null; -//// $eight = null; -//// $nine = null; -//// } -//// 1.现金红包XXX元(限时),2. 免费升级驾驶员人身意外保障26万。3.赠送VIP卡(包含进口封釉、内饰臭氧杀菌、空调风道清洗、四轮定位等十项服务) -//// 4.尊享VIP服务包(人伤极速赔、客户经理一对一、全程代办、双方事故直赔、一案多修、升级救援、代步车等15项理赔升级服务)5.升级划痕险不用投保享一案多修服务 6.享受北京市600家4S店直赔服务。 -//// 7.享受全国免费事故, -//// 非事故救援(送水,搭电,换备胎,现场小修)8.享受玻璃上门更换 9.享受自然灾害百分百赔付(地震除外) 10.享受无法找到第三方无免赔服务 详询186******联系我,回复TD拒收 -// -// $msg .=' -//1.现金红包'.$total1_dis.'元(限时), -//2. 免费升级驾驶员人身意外保障26万。 -//3.赠送VIP卡(包含进口封釉、内饰臭氧杀菌、空调风道清洗、四轮定位等十项服务) -//4.尊享VIP服务包(人伤极速赔、客户经理一对一、全程代办、双方事故直赔、一案多修、升级救援、代步车等15项理赔升级服务) -//5.升级划痕险不用投保享一案多修服务 -//6.享受全国免费事故,非事故救援(送水,搭电,换备胎,现场小修),免费上门跟换玻璃 -//7.享受无法找到第三方无免赔服务 详询'.$this->my->phone.'加我(微信同号),回复TD拒收'; -// -//// } -// -// -// $result['success'] = true; -// $result['msg'] = $msg; -// return $result; -// } public function actionSmsSend() { Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; $MessageContent = $request->post('msg'); $UserNumber = $request->post('tel'); - $company2_id = $request->post('company2_id'); + $company_id = $request->post('company_id'); - if($company2_id == 0){ + if($company_id == 0){ $result['msg'] = '保险公司不能为空'; return $result; } @@ -4910,22 +4175,23 @@ class CarController extends BaseController $MessageContent = str_replace("\f","",$MessageContent); $MessageContent = str_replace("\t","",$MessageContent); - $url = 'https://sms.yunpian.com/v2/sms/single_send.json'; - $params['apikey'] = '453067dc4b9eb0dc0c448674d79e85aa'; + //$url = 'https://sms.yunpian.com/v2/sms/single_send.json'; + $url = 'https://www.banmacar.com/api/single-send'; + $params['token'] = '84c5722fd1455582c53b7195ccef44c2'; $params['mobile'] = $UserNumber; - $params['text'] = $MessageContent; + $params['content'] = $MessageContent; $post_url = http_build_query($params); $msg = MyLib::Post($post_url,$url); // $msg = mb_convert_encoding($msg,'UTF8','GBK'); // parse_str($msg,$obj); - $obj = json_decode($msg); + $obj = json_decode($msg,true); $result = array(); // $result['success'] = true; - if($obj->code == 0){ - $result['msg'] = $obj->msg; + if($obj['success']) { + $result['msg'] = $obj['msg']; }else{ - $result['msg'] = $obj->msg.'('.$obj->detail.')'; + $result['msg'] = $obj['msg']; } return $result; } @@ -4939,30 +4205,30 @@ class CarController extends BaseController $result['msg'] = '生成失败'; $order_id = $request->post('order_id'); - $company2_id = $request->post('company2_id'); + $company_id = $request->post('company_id'); // $company2_name = InsurerCompany2T::findOne($company2_id)->name; - $company2_name =''; - if($company2_id == 1){ - $company2_name = '人保车险'; - }elseif ($company2_id ==8){ - $company2_name = '平安车险'; - - }elseif ($company2_id == 4){ - $company2_name = '太平洋车险'; - }elseif ($company2_id ==7){ - $company2_name = '人寿车险'; + $company_name =''; + if($company_id == 1){ + $company_name = '人保车险'; + }elseif ($company_id ==8){ + $company_name = '平安车险'; + + }elseif ($company_id == 4){ + $company_name = '太平洋车险'; + }elseif ($company_id ==7){ + $company_name = '人寿车险'; } - $company2 =''; - if($company2_id == 1){ - $company2 = '人保'; - }elseif ($company2_id == 8){ - $company2 = '平安'; + $company =''; + if($company_id == 1){ + $company = '人保'; + }elseif ($company_id == 8){ + $company = '平安'; - }elseif ($company2_id == 4){ - $company2 = '太平洋'; - }elseif ($company2_id == 7){ - $company2 = '太平洋'; + }elseif ($company_id == 4){ + $company = '太平洋'; + }elseif ($company_id == 7){ + $company = '太平洋'; } // var_dump($order_id); @@ -4984,10 +4250,12 @@ class CarController extends BaseController $insurer_type_items = InsurerTypeT::find()->all(); - $msg = '【'.$company2_name.'】尊敬的'.$car_info->car_no.'客户您好:'.$company2.$this->my->name.'为您报价:'; + $tmp_total = $total_real; + $msg = '【'.$company_name.'】尊敬的'.$car_info->car_no.'客户您好:'.$company.$this->my->name.'为您报价:'; $msg .= '交强、'; if($total3 > 0) { $msg .= '车船税、'; + $tmp_total += $total3; } // $msg .= '商业'.$total1.'元'; // $msg .= '总计'.($total_all).'元,'; @@ -5028,11 +4296,9 @@ class CarController extends BaseController } $msg .= $msg1; -// $msg .= '总计'.($total_all).'元;'; - $msg .= '保费实收'.($total_real).'元;'; + $msg .= '保费实收'.($tmp_total).'元;'; $msg .= '祝您生活愉快。'; -// } $result['success'] = true; @@ -5140,7 +4406,7 @@ class CarController extends BaseController $items = $query->all(); $data = []; - $data['total'] = count($items); + $data['total'] = $total; $data['rows'] = []; foreach($items as $item) { $row = $item->toArray(); @@ -5151,6 +4417,36 @@ class CarController extends BaseController return $data; } + public function actionOrderHistoryJson() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $car_id = $request->get('car_id'); + $offset = $request->get('offset', 0); + $limit = $request->get('limit', 10); + + $query = OrderT::find() + ->where(['car_id'=>$car_id]) + ->andWhere('status_id>1') + ->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['username'] = $item->user->getShowName(); + $row['status'] = $item->status->name; + $data['rows'][] = $row; + } + + return $data; + } + public function actionOrderAdd() { $request = Yii::$app->request; $car_id = $request->get('car_id'); @@ -5208,15 +4504,57 @@ class CarController extends BaseController ]); } - public function canCancelAppointment($date1,$date2){ - $insurer_date = $date1; - if ($insurer_date == '') { - $insurer_date = $date2; + public function actionInvalidCar() { + $request = Yii::$app->request; + $car_id = $request->get('car_id'); + + $invalid_items = InvalidT::getTree(); + + return $this->render('invalid-car', [ + 'car_id' => $car_id, + 'invalid_items' => $invalid_items + ]); + } + + public function actionInvalidSave() { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $car_id = $request->post('car_id'); + $invalid_id = $request->post('invalid_id'); + + if($invalid_id == 0) { + $result['msg'] = '请选择无效理由'; + return $result; } - $begin_zhi_date = date('Y-m-d', strtotime('-3 month', strtotime($insurer_date . ' 00:00:00'))); - $cur_date = date('Y-m-d'); - $d1 = strtotime($cur_date); - $d2 = strtotime($begin_zhi_date); - return (int)round(($d2 - $d1) / 3600 / 24) <= 0; + + $tran = CarT::getDb()->beginTransaction(); + try { + $car_info = CarT::findOne(['id'=>$car_id]); + $car_info->location = 5; + if(!$car_info->save(false)) { + throw new Exception(print_r($car_info->getFirstErrors(),true)); + } + + $invalid_info = CarInvalidT::findOne(['id'=>$car_info->id]); + if(!$invalid_info) { + $invalid_info = new CarInvalidT(false); + $invalid_info->id = $car_info->id; + $invalid_info->user_id = $this->my->id; + $invalid_info->invalid_id = $invalid_id; + if(!$invalid_info->save(false)) { + throw new Exception(print_r($invalid_info->getFirstErrors(),true)); + } + } + $this->addLog($car_info->id,'从业务员无效车辆信息',1); + + $result['success'] = true; + $result['msg'] = '操作成功'; + + $tran->commit(); + } catch (\Exception $e) { + $tran->rollBack(); + $result['msg'] = $e->getMessage(); + } + return $result; } } diff --git a/frontend/controllers/FinanceController.php b/frontend/controllers/FinanceController.php index 2a588f7..62fba5b 100644 --- a/frontend/controllers/FinanceController.php +++ b/frontend/controllers/FinanceController.php @@ -30,6 +30,7 @@ use common\models\GiftType3T; use common\models\GroupT; use common\models\Gz2T; use common\models\GzT; +use common\models\InsurerCompany2T; use common\models\InsurerCompanyT; use common\models\InsurerTypeT; use common\models\OrderCaiwuT; @@ -213,7 +214,7 @@ class FinanceController extends \frontend\controllers\UserBaseController foreach($items as $item) { $row = $item->toArray(); $row['group'] = $item->user->group->name; - $row['company_name'] = $item->order->company->name; + $row['company_name'] = $item->order->company2->name; $row['username'] = $item->user->getShowName(); $row['submit_date'] = $item->order->submit_date; $row['print_date'] = $item->order->print_date; @@ -226,6 +227,10 @@ class FinanceController extends \frontend\controllers\UserBaseController public function actionReceiptImport() { return $this->render('receipt-import'); } + public function actionReceipt2Import() { + return $this->render('receipt2-import'); + } + public function actionEmsReceipt() { $request = Yii::$app->request; @@ -3607,8 +3612,7 @@ class FinanceController extends \frontend\controllers\UserBaseController return $this->render('receipt-info', [ - 'caiwu_info' => $caiwu_info, - 'back_params' => $back_params, + 'caiwu_info' => $caiwu_info ]); } public function actionEmsReceiptInfo() @@ -3864,10 +3868,17 @@ class FinanceController extends \frontend\controllers\UserBaseController return $result; } - public function actionReceipt2() + public function actionReceipt2() { + $insurer_company_items = InsurerCompany2T::find()->all(); + + return $this->render('receipt2', [ + 'insurer_company_items' => $insurer_company_items + ]); + } + public function actionReceipt2Json() { + Yii::$app->response->format = Response::FORMAT_JSON; $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'); @@ -3878,43 +3889,14 @@ class FinanceController extends \frontend\controllers\UserBaseController $sort_key = $request->get('sort_key'); $sort_value = $request->get('sort_value'); $company_id = $request->get('company_id'); - if ($page < 1) $page = 1; + $insurer_type = $request->get('insurer_type'); + $offset = $request->get('offset', 0); + $limit = $request->get('limit', 10); -// $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); + ->where('caiwu_t.budian_rate > 0'); if( $company_id > 0) { $query = $query->andWhere('order_t.company_id='.$company_id); } @@ -3926,10 +3908,10 @@ class FinanceController extends \frontend\controllers\UserBaseController } if ($status > 0) { if ($status == 1) { - $query = $query->andWhere('r_date=""'); + $query = $query->andWhere('b1_date is null'); } if ($status == 2) { - $query = $query->andWhere('r_date<>""'); + $query = $query->andWhere('b1_date is not null'); } } if ($begin_date != "") { @@ -3944,43 +3926,38 @@ class FinanceController extends \frontend\controllers\UserBaseController if ($r_end_date != "") { $query = $query->andWhere('caiwu_t.r_date<="' . $r_end_date . '"'); } + + if($insurer_type != 0){ + $query = $query->andWhere('caiwu_t.insurer_type =' . $insurer_type); + } // echo $query->createCommand()->rawSql; $total = $query->count(); - $pagination = new Pagination(['totalCount' => $total, 'pageSize' => 20]); - $pagination->setPage($page - 1); - - $query = $query->offset($pagination->offset)->limit($pagination->limit); + $query->offset($offset)->limit($limit); $items = $query->all(); -// $sum_r_total = $query->sum('r_total'); - //商业净保费综合 -// $sum_total_clear = $query->sum('total_clear'); - - //商业总保费 -// $sum_total = $query->sum('total'); + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $row['company_name'] = $item->order->company2->name; + $row['print_date'] = $item->order->print_date; + $row['total_real'] = round($item->total_clear,2); + $row['budian_rate'] = $item->budian_rate; + $row['budian_money'] = $item->budian_money; + $row['b1_total'] = $item->b1_total; + $row['b1_date'] = $item->b1_date; + $row['b2_total'] = $item->b2_total; + $row['b2_date'] = $item->b2_date; + $row['b3_total'] = $item->b3_total; + $row['b3_date'] = $item->b3_date; + $row['b_total'] = round($row['b1_total']+$row['b2_total']+$row['b3_total'],2); + $row['un_b_total'] = round($row['budian_money'] - $row['b_total'],2); + $data['rows'][] = $row; + } - $page_info = MyLib::getPageInfo($pagination); - $company_items = InsurerCompanyT::find()->all(); - 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, - 'company_items' => $company_items, - 'company_id' => $company_id, - 'sort_value' => $sort_value -// 'sum_r_total' => $sum_r_total, -// 'sum_total_clear' => $sum_total_clear, -// 'sum_total' => $sum_total, - ]); + return $data; } public function actionReceipt2Output() { @@ -4139,22 +4116,13 @@ class FinanceController extends \frontend\controllers\UserBaseController $insurer_total = $cell->getValue();//$data[$i][6]; $cell = $currentSheet->getCellByColumnAndRow(7, $i); $insurer_date = $cell->getFormattedValue(); -// $insurer_date = \PHPExcel_Shared_Date::ExcelToPHP($cell->getValue());//$data[$i][7]; $cell = $currentSheet->getCellByColumnAndRow(8, $i); $car_no = $cell->getValue();//$data[$i][8]; -// if($insurer_no == 'PDAA201811010000089441') { -// echo $insurer_no.'='.$policy_man.'='.$total_real.'='.$total_rate.'='; -// echo $pay_total.'='.$insurer_total.'='.date('Y-m-d',$insurer_date).'='.$car_no."\r\n"; -// exit; -// } -// $row = CaiwuT::findOne(['car_no' => $car_no, 'insurer_no' => $insurer_no]); $row = CaiwuT::findOne(['insurer_no' => $insurer_no]); if ($row) { CaiwuErrorT::deleteAll(['insurer_no' => $insurer_no]); -// echo $insurer_no.'='.$policy_man.'='.$total_real.'='.$total_rate.'='; -// echo $pay_total.'='.$insurer_total.'='.date('Y-m-d',$insurer_date).'='.$car_no."\r\n"; if($bdlx == 1) { $row->b1_total = $insurer_total; $row->b1_date = $insurer_date; @@ -6356,7 +6324,7 @@ class FinanceController extends \frontend\controllers\UserBaseController $result['msg'] = '操作失败'; $web_path = Yii::$app->getBasePath() . '/../frontend/web'; - $filename = $web_path . $request->post('urlfile'); + $filename = $web_path . $request->post('file'); $base_filename=$request->post('file'); //读取Excel 2007 @@ -6379,19 +6347,19 @@ class FinanceController extends \frontend\controllers\UserBaseController for ($i = 2; $i <= $rowCount; $i++) { // echo $i.'/'.$rowCount."..."; $cell = $currentSheet->getCellByColumnAndRow(0, $i); - $car_no = $cell->getValue(); + $car_no = $cell->getFormattedValue(); // $cell = $currentSheet->getCellByColumnAndRow(1, $i); // $car_man = $cell->getValue(); $cell = $currentSheet->getCellByColumnAndRow(1, $i); - $factory_model = $cell->getValue();//$data[$i][3]; + $factory_model = $cell->getFormattedValue();//$data[$i][3]; $cell = $currentSheet->getCellByColumnAndRow(2, $i); - $engine_no = $cell->getValue();//$data[$i][2]; + $engine_no = $cell->getFormattedValue();//$data[$i][2]; // var_dump($cars); $cell = $currentSheet->getCellByColumnAndRow(3, $i); - $car_frame_no = $cell->getValue();//$data[$i][1]; + $car_frame_no = $cell->getFormattedValue();//$data[$i][1]; // var_dump($car_frame_no); $cell = $currentSheet->getCellByColumnAndRow(4, $i); - $register_date = $cell->getValue();//$data[$i][8]; + $register_date = $cell->getFormattedValue(); $cell = $currentSheet->getCellByColumnAndRow(5, $i); $company = $cell->getValue();//$data[$i][8]; $cell = $currentSheet->getCellByColumnAndRow(6, $i); @@ -6413,11 +6381,11 @@ class FinanceController extends \frontend\controllers\UserBaseController $cell = $currentSheet->getCellByColumnAndRow(14, $i); $id_phone = $cell->getFormattedValue(); + if($car_no == '' && $engine_no == '' && $car_frame_no == '') continue; $car_info = CarT::findOne(['car_frame_no' => $car_frame_no]); if ($car_info) { - if($car_no != ''){ $car_info->car_no = $car_no; } @@ -6464,17 +6432,11 @@ class FinanceController extends \frontend\controllers\UserBaseController if($car_man_phone != ''){ $car_info->phone = $car_man_phone; } - - - - - - -// $car_info->save(); - if(!$car_info->save(false)) { + if(!$car_info->save(false)) { var_dump($car_info->errors); exit; } + $insert_total++; } @@ -6528,9 +6490,6 @@ class FinanceController extends \frontend\controllers\UserBaseController if($car_man_phone != ''){ $car_info->phone = $car_man_phone; } - - -// $car_info->save(); if(!$car_info->save(false)) { var_dump($car_info->errors); exit; @@ -6539,13 +6498,6 @@ class FinanceController extends \frontend\controllers\UserBaseController } } -// $log = new ImportLogT(); -// $datacount=$rowCount; -// $log->filename = $base_filename; -// $log->total = $datacount; -// $log->success = $insert_total; -// $log->success_rate = ($insert_total/$datacount) * 100; -// $log->save(); $result['success'] = true; $result['msg'] = '操作成功'; @@ -6555,7 +6507,10 @@ class FinanceController extends \frontend\controllers\UserBaseController } public function actionBudianList() { - return $this->render('budian-list'); + $company_items = InsurerCompany2T::find()->all(); + return $this->render('budian-list',[ + 'company_items' => $company_items + ]); } public function actionBudianListJson() { @@ -6569,29 +6524,18 @@ class FinanceController extends \frontend\controllers\UserBaseController $company_id = $request->get('company_id'); $insurer_type = $request->get('insurer_type'); - - $budian_rate = $request->get('budian_rate'); - $offset = $request->get('offset',0); $limit = $request->get('limit', 10); - - - $query = CaiwuT::find() ->leftJoin(OrderT::tableName(), "order_t.id=caiwu_t.order_id") ->orderBy('order_t.print_date DESC'); - - if( $insurer_type > 0) { $query->andWhere('caiwu_t.insurer_type='.$insurer_type); } - - if( $company_id > 0) { - $query->andWhere('order_t.company_id='.$company_id); + $query->andWhere('order_t.company2_id='.$company_id); } - if($car_no_type == 1){ $query->andWhere('caiwu_t.car_no like "' . '京' . '%"'); }elseif($car_no_type == 2){ @@ -6605,17 +6549,12 @@ class FinanceController extends \frontend\controllers\UserBaseController $query->andWhere('caiwu_t.total_clear <=' . $end_totalclear); } - if ($begin_date != "") { $query->andWhere('order_t.print_date>="' . $begin_date . '"'); } if ($end_date != "") { $query->andWhere('order_t.print_date<="' . $end_date . '"'); } - - $total1_clear_all = $query->sum('total_clear'); - $total_money_all = $query->sum('budian_money'); - $total = $query->count(); $query->offset($offset)->limit($limit); @@ -6626,6 +6565,11 @@ class FinanceController extends \frontend\controllers\UserBaseController $data['rows'] = []; foreach($items as $item) { $row = $item->toArray(); + $row['company_name'] = $item->order->company2->name; + $row['print_date'] = $item->order->print_date; + $row['insurer_type'] = '商业'; + if($item->insurer_type != 1) + $row['insurer_type'] = '交强'; $row['user'] = $item->user?$item->user->getShowName():''; $data['rows'][] = $row; } @@ -6642,84 +6586,65 @@ class FinanceController extends \frontend\controllers\UserBaseController $result['success'] = false; $result['msg'] = '操作失败'; - - $begin_date = $request->get('begin_date'); - $end_date = $request->get('end_date'); - $user_names = $request->get('user_names'); + $begin_date = $request->get('begin_date',date('Y-m-d')); + $end_date = $request->get('end_date',date('Y-m-d')); $begin_totalclear = $request->get('begin_totalclear'); $end_totalclear = $request->get('end_totalclear'); $car_no_type = $request->get('car_no_type'); $company_id = $request->get('company_id'); $insurer_type = $request->get('insurer_type'); - - - $budian_rate = $request->get('budian_rate'); - $query = CaiwuT::find() ->leftJoin(OrderT::tableName(), "order_t.id=caiwu_t.order_id") -// ->where('caiwu_t.insurer_type=1') ->orderBy('order_t.print_date DESC'); - if( $insurer_type > 0) { - $query = $query->andWhere('caiwu_t.insurer_type='.$insurer_type); + $query->andWhere('caiwu_t.insurer_type='.$insurer_type); } - if( $company_id > 0) { - $query = $query->andWhere('order_t.company_id='.$company_id); + $query->andWhere('order_t.company2_id='.$company_id); } - if($car_no_type == 1){ - $query = $query->andWhere('caiwu_t.car_no like "' . '京' . '%"'); + $query->andWhere('caiwu_t.car_no like "' . '京' . '%"'); }elseif($car_no_type == 2){ - $query = $query->andWhere('caiwu_t.car_no not like "' . '京' . '%"'); + $query->andWhere('caiwu_t.car_no not like "' . '京' . '%"'); } if($begin_totalclear != ''){ - $query = $query->andWhere('caiwu_t.total_clear >=' . $begin_totalclear); + $query->andWhere('caiwu_t.total_clear >=' . $begin_totalclear); } if($end_totalclear != ''){ - $query = $query->andWhere('caiwu_t.total_clear <=' . $end_totalclear); + $query->andWhere('caiwu_t.total_clear <=' . $end_totalclear); } - if ($begin_date != "") { - $query = $query->andWhere('order_t.print_date>="' . $begin_date . '"'); + $query->andWhere('order_t.print_date>="' . $begin_date . '"'); } if ($end_date != "") { - $query = $query->andWhere('order_t.print_date<="' . $end_date . '"'); + $query->andWhere('order_t.print_date<="' . $end_date . '"'); } - $items = $query->all(); - - $tran = OrderCaiwuT::getDb()->beginTransaction(); try { foreach ($items as $item){ -// $order_caiwu_info = $item->orderCaiwu; -// $order_info = $item->order; - if($budian_rate != '') { $item->budian_rate = $budian_rate; $item->budian_money = $item->total_clear * $budian_rate / 100; } - $item->save(); - + if(!$item->save()) { + throw new \Exception(print_r($item->getErrors(), true)); + } } - + $tran->commit(); $result['success'] = true; $result['msg'] = '保存成功'; - $tran->commit(); - } catch(\Exception $e) { $tran->rollBack(); - throw $e; + $result['msg'] = $e->getMessage(); } - return $result; } diff --git a/frontend/controllers/Gift2Controller.php b/frontend/controllers/Gift2Controller.php deleted file mode 100644 index 35e7632..0000000 --- a/frontend/controllers/Gift2Controller.php +++ /dev/null @@ -1,591 +0,0 @@ -request->cookies; - $user_id = MyLib::encrypt($cookie->get('aid'),'DECODE'); - - if($user_id != 0) - { - $this->my = UserT::findOne(['id'=>$user_id]); - } else { - Yii::$app->response->redirect('/common/login')->send(); - exit; - } - } - - public function actionGift1Index() - { - $request = Yii::$app->request; - $code = $request->get('code'); - $car_no = $request->get('car_no'); - $status = $request->get('status',6); - $type_id = $request->get('type_id',0); - $page = $request->get('page',1); - if($page < 1) $page = 1; - - $query = GiftTicketT::find() - ->orderBy('id DESC'); - if($code != '') { - $query = $query->andWhere('code="'.$code.'"'); - } - if($car_no != '') { - $query = $query->andWhere('car_no like "'.$car_no.'"'); - } - if($status != '' && $status != 6) { - $query = $query->andWhere('status='.$status); - } - if($type_id > 0) { - $query = $query->andWhere('type_id='.$type_id); - } -// echo $query->createCommand()->rawSql; - $total = $query->count(); - - $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]); - $pagination->setPage($page-1); - - $query = $query->offset($pagination->offset)->limit($pagination->limit); - $items = $query->all(); - - $type_items = GiftType2T::find()->all(); - $page_info = MyLib::getPageInfo($pagination); - - return $this->render('gift1-index',[ - 'items' => $items, - 'code' => $code, - 'car_no' => $car_no, - 'page' => $page, - 'page_info' => $page_info, - 'status' => $status, - 'type_items' => $type_items, - 'type_id' => $type_id, - ]); - } - - public function actionGift2Index() - { - return $this->render('gift2-index'); - } - - public function actionIndex() - { - $request = Yii::$app->request; - $code = $request->get('code'); - $car_no = $request->get('car_no'); - $page = $request->get('page',1); - if($page < 1) $page = 1; - - $query = GiftTicketT::find() - ->orderBy('id DESC'); - if($code != '') { - $query = $query->andWhere('code="'.$code.'"'); - } - if($car_no != '') { - $query = $query->andWhere('car_no="'.$car_no.'"'); - } -// echo $query->createCommand()->rawSql; - $total = $query->count(); - - $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]); - $pagination->setPage($page-1); - - $query = $query->offset($pagination->offset)->limit($pagination->limit); - $items = $query->all(); - - $page_info = MyLib::getPageInfo($pagination); - - return $this->render('index',[ - 'items' => $items, - 'code' => $code, - 'car_no' => $car_no, - 'page' => $page, - 'page_info' => $page_info - ]); - } - - public function actionAdd() - { - $request = Yii::$app->request; - $type_items = GiftType2T::find()->all(); - - return $this->render('add',[ - 'type_items' => $type_items, - ]); - } - - public function actionAddSave() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '保存失败'; - - if($request->isPost) { - $min_code = $request->post('min_code'); - $max_code = $request->post('max_code'); - $type_id = $request->post('type_id'); - - if($min_code == '') { - $result['msg'] = '请输入开始编号!'; - return $result; - } - if($max_code == '') { - $result['msg'] = '请输入结束编号!'; - return $result; - } - if($type_id == 0) { - $result['msg'] = '请选择类型!'; - return $result; - } - - $row = null; - for($i = $min_code; $i <= $max_code; $i++) { - $row = GiftTicketT::findOne(['code'=>$i,'type_id'=>$type_id]); - if(!$row) { - $row = new GiftTicketT(); - $row->code = $i; - $row->type_id = $type_id; - $row->input_date = date('Y-m-d H:i:s'); - $row->op_id = $this->my->id; - $row->status = 0; - $row->save(); - } - } - - $result['success'] = true; - $result['msg'] = '保存成功'; - } - return $result; - } - - public function actionOutput() - { - $request = Yii::$app->request; - $type_items = GiftType2T::find()->all(); - - $gift_group_items = GiftGroupT::find()->all(); - - return $this->render('output',[ - 'type_items' => $type_items, - 'gift_group_items' => $gift_group_items, - ]); - } - - public function actionOutputSave() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '保存失败'; - - if($request->isPost) { - $codes = $request->post('codes',array()); - $types = $request->post('types',array()); - $car_no = $request->post('car_no'); - - $tran = GiftTicketT::getDb()->beginTransaction(); - try { - foreach($types as $index => $type_id) { - if($type_id == 0) continue; - $ticket_info = GiftTicketT::findOne(['code'=>$codes[$index],'type_id'=>$type_id]); - if(!$ticket_info) { - $result['msg'] = '第'.($index+1).'组礼品编号不存在!'; - return $result; - } - if($ticket_info->status != 0) { - $result['msg'] = '第'.($index+1).'组礼品编号已经出库!'; - return $result; - } - $ticket_info->group_id = 0; - $ticket_info->car_no = $car_no; - $ticket_info->status = 1; - $ticket_info->use_date = date('Y-m-d H:i:s'); - $ticket_info->op_id = $this->my->id; - if(!$ticket_info->save()) { - var_dump($ticket_info->errors); - } - } - - $tran->commit(); - } catch(\Exception $e) { - $tran->rollBack(); - throw $e; - } - - $result['success'] = true; - $result['msg'] = '保存成功'; - } - return $result; - } - - public function actionEdit() - { - $request = Yii::$app->request; - $id = $request->get('id',0); - $back_params = $request->get('back_params'); - if($id > 0) { - $info = GiftTicketT::findOne(['id'=>$id]); - } else { - $info = new GiftTicketT(); - } - - $type_items = GiftTypeT::find()->all(); - - return $this->render('edit',[ - 'info' => $info, - 'type_items' => $type_items, - 'back_params' => $back_params, - ]); - } - - public function actionSave() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '保存失败'; - - if($request->isPost) { - $id = $request->post('id'); - $status = $request->post('status'); - $car_no = $request->post('car_no'); - - $ticket_info = GiftTicketT::findOne(['id'=>$id]); - if(!$ticket_info) { - $result['msg'] = '礼品券不存在!'; - return $result; - } - - $ticket_info->car_no = $car_no; - $ticket_info->status = $status; - $ticket_info->use_date = date('Y-m-d H:i:s'); - $ticket_info->op_id = $this->my->id; - $ticket_info->save(); - - $result['success'] = true; - $result['msg'] = '保存成功'; - } - return $result; - } - - public function actionDelete() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '删除失败'; - - if($request->isPost) { - $id = $request->post('id',0); - - if($id > 0) { - $row = GiftTicketT::findOne(['id'=>$id]); - if($row->status == 0) { - $row->delete(); - - $result['success'] = true; - $result['msg'] = '删除成功'; - } - - } - } - return $result; - } - - public function actionTicket2List() - { - $request = Yii::$app->request; - $code = $request->get('code'); - $car_no = $request->get('car_no'); - $type_id = $request->get('type_id',0); - $page = $request->get('page',1); - if($page < 1) $page = 1; - - $query = GiftTicketT::find() - ->where('status=1') - ->orderBy('id DESC'); - if($code != '') { - $query = $query->andWhere('code="'.$code.'"'); - } - if($car_no != '') { - $query = $query->andWhere('car_no like "'.$car_no.'"'); - } - if($type_id > 0) { - $query = $query->andWhere('type_id='.$type_id); - } -// echo $query->createCommand()->rawSql; - $total = $query->count(); - - $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]); - $pagination->setPage($page-1); - - $query = $query->offset($pagination->offset)->limit($pagination->limit); - $items = $query->all(); - - $type_items = GiftType2T::find()->all(); - $page_info = MyLib::getPageInfo($pagination); - - return $this->render('ticket2-list',[ - 'items' => $items, - 'code' => $code, - 'car_no' => $car_no, - 'page' => $page, - 'page_info' => $page_info, - 'type_items' => $type_items, - 'type_id' => $type_id, - ]); - } - - public function actionTicket2Output() - { - $request = Yii::$app->request; - $id = $request->get('id',0); - if($id == 0) { - echo '无效礼券'; - exit; - } - $ticket_info = GiftTicketT::findOne(['id'=>$id]); - - $gift_items = Gift2T::find()->all(); - $type_items = GiftType2T::find()->all(); - - return $this->render('ticket2-output',[ - 'ticket_info' => $ticket_info, - 'gift_items' => $gift_items, - 'type_items' => $type_items - ]); - } - - public function actionTicket2OutputSave() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '保存失败'; - - if($request->isPost) { - $ticket_id = $request->post('ticket_id'); - $gift_id = (int)$request->post('gift_id'); - $send_type = $request->post('send_type'); - $send_no = $request->post('send_no'); - - $ticket_info = GiftTicketT::findOne(['id'=>$ticket_id]); - if(!$ticket_info) { - $result['msg'] = '礼品编号不存在!'; - return $result; - } - - if($gift_id == 0) { - $result['msg'] = '请选择礼品!'; - return $result; - } - - $ticket2_info = new GiftTicket2T(); - $ticket2_info->ticket_id = $ticket_info->id; - $ticket2_info->gift_id = $gift_id; - $ticket2_info->send_type = $send_type; - $ticket2_info->send_no = $send_no; - - $ticket2_info->status = 1; - $ticket2_info->op_id = $this->my->id; - $ticket2_info->use_date = date('Y-m-d H:i:s'); - - $ticket2_info->save(); - - $ticket_info->status = 2; - $ticket_info->use_date; - $ticket_info->op_id = $this->my->id; - $ticket_info->save(); - - //礼品 - $gift_info = Gift2T::findOne(['id'=>$gift_id]); - $gift_info->total = $gift_info->total - 1; - $gift_info->save(); - - $result['success'] = true; - $result['msg'] = '保存成功'; - } - return $result; - } - - public function actionTicket2Edit() - { - $request = Yii::$app->request; - $id = $request->get('id',0); - if($id > 0) { - $info = GiftTicket2T::findOne(['id'=>$id]); - } else { - $info = new GiftTicket2T(); - } - - $gift_items = GiftT::find()->all(); - $type_items = GiftTypeT::find()->all(); - - return $this->render('ticket2-edit',[ - 'info' => $info, - 'gift_items' => $gift_items, - 'type_items' => $type_items - ]); - } - - public function actionTicket2Save() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '保存失败'; - - if($request->isPost) { - $id = $request->post('id',0); - $status = (int)$request->post('status'); - - $row = GiftTicket2T::findOne(['id'=>$id]); - $gift_info = $row->gift; - $gift_info->total = $gift_info->total + 1; - $gift_info->save(); - $row->status = 3; - $row->use_date = date('Y-m-d H:i:s'); - $row->save(); - - $result['success'] = true; - $result['msg'] = '保存成功'; - } - return $result; - } - - public function actionGift2List() - { - $request = Yii::$app->request; - $name = $request->get('name'); - - $query = Gift2T::find(); - if($name != '') { - $query = $query->andWhere(['like','name',$name]); - } - $items = $query->all(); - - return $this->render('gift2-list',[ - 'items' => $items, - 'name' => $name - ]); - } - - public function actionGift2Edit() - { - $request = Yii::$app->request; - $id = $request->get('id',0); - if($id > 0) { - $info = Gift2T::findOne(['id'=>$id]); - } else { - $info = new GiftT(); - } - - return $this->render('gift2-edit',[ - 'info' => $info - ]); - } - - public function actionGift2Save() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '保存失败'; - - if($request->isPost) { - $id = $request->post('id',0); - $name = $request->post('name'); - $price = $request->post('price'); - $remark = $request->post('remark'); - $total = (int)$request->post('total'); - - if($name == '') { - $result['msg'] = '请输入名称!'; - return $result; - } - - $row = null; - if($id > 0) { - $row = Gift2T::findOne(['id'=>$id]); - } else { - $row = new Gift2T(); - } - $row->name = $name; - $row->price = $price; - $row->remark = $remark; - $row->total = $total; - $row->save(); - - $result['success'] = true; - $result['msg'] = '保存成功'; - } - return $result; - } - - public function actionGift2Delete() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '删除失败'; - - if($request->isPost) { - $id = $request->post('id',0); - - if($id > 0) { - $row = Gift2T::findOne(['id'=>$id]); - $row->delete(); - - $result['success'] = true; - $result['msg'] = '删除成功'; - } - } - return $result; - } - - public function actionStastics() - { - $gift_type_items = GiftType2T::find()->all(); - $gift_items = Gift2T::find()->all(); - - return $this->render('stastics',[ - 'gift_type_items' => $gift_type_items, - 'gift_items' => $gift_items, - ]); - } -} diff --git a/frontend/controllers/GiftController.php b/frontend/controllers/GiftController.php index 28aae4d..43a0842 100644 --- a/frontend/controllers/GiftController.php +++ b/frontend/controllers/GiftController.php @@ -8,6 +8,7 @@ use common\models\EmsT; use common\models\GiftT; use common\models\GiftTicketTUse; use common\models\GiftTypeT; +use common\models\GiftUseLogT; use common\models\GroupT; use common\models\InsurerTypeT; use common\models\OrderT; @@ -111,7 +112,6 @@ class GiftController extends \yii\web\Controller $img = $request->post('img'); $price = $request->post('price'); $remark = $request->post('remark'); - $total = (int)$request->post('total'); $use_num = (int)$request->post('use_num'); if($name == '') { @@ -132,7 +132,6 @@ class GiftController extends \yii\web\Controller $row->price = $price; $row->original_img = $img; $row->remark = $remark; - $row->total = $total; $row->use_num = $use_num; $row->pinyin_name = $pin_name; $row->save(); @@ -787,7 +786,7 @@ class GiftController extends \yii\web\Controller public function actionGiftUse() { $type_items = GiftT::find() - ->where(['type_id'=>2,'is_delete'=>0]) + ->where(['type_id'=>1,'is_delete'=>0]) ->all(); return $this->render('gift-use', [ 'type_items' => $type_items @@ -799,7 +798,9 @@ class GiftController extends \yii\web\Controller Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; $code = $request->get('code'); + $car_id = $request->get('car_id',0); $car_no = $request->get('car_no'); + $order_id = $request->get('order_id'); $username = $request->get('username'); $s_begin_date = $request->get('s_begin_date'); $s_end_date = $request->get('s_end_date'); @@ -820,19 +821,144 @@ class GiftController extends \yii\web\Controller ->where('gift_t.type_id=2') ->orderBy('id DESC'); if($code != '') { - $query = $query->andWhere('gift_ticket_t_use.code="'.$code.'"'); + $query->andWhere('gift_ticket_t_use.code="'.$code.'"'); + } + if($car_id > 0) { + $query->andWhere('order_t.car_id='.$car_id); + } + if($order_id > 0) { + $query->andWhere('order_t.id='.$order_id); } if($car_no != '') { - $query = $query->andWhere('gift_ticket_t_use.car_no like "'.$car_no.'"'); + $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->andWhere('gift_ticket_t_use.op_id='.$user->id); + } + + if($s_begin_date != ''){ + $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['username'] = ($item->user && $item->status > 0)?$item->user->getShowName():''; + $row['submit_user'] = $order_info->user ? $order_info->user->getShowName():''; + $row['status'] = $item->getStatus(); + $row['use_num'] = $gift_info->use_num; + $data['rows'][] = $row; + } + + return $data; + } + + public function actionTicketUse() { + $type_items = GiftT::find() + ->where(['type_id'=>2,'is_delete'=>0]) + ->all(); + return $this->render('ticket-use', [ + 'type_items' => $type_items + ]); + } + public function actionTicketUseJson() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $code = $request->get('code'); + $car_id = $request->get('car_id',0); + $car_no = $request->get('car_no'); + $order_id = $request->get('order_id'); + $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->andWhere('gift_ticket_t_use.code="'.$code.'"'); + } + if($car_id > 0) { + $query->andWhere('order_t.car_id='.$car_id); + } + if($order_id > 0) { + $query->andWhere('order_t.id='.$order_id); + } + if($car_no != '') { + $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); + $query->andWhere('gift_ticket_t_use.op_id='.$user->id); } if($s_begin_date != ''){ - $query = $query->andWhere('order_t.submit_date>="'.$s_begin_date.'"'); + $query->andWhere('order_t.submit_date>="'.$s_begin_date.'"'); } if($s_end_date != ''){ $query = $query->andWhere('order_t.submit_date<="'.$s_begin_date.'"'); @@ -888,7 +1014,8 @@ class GiftController extends \yii\web\Controller $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['username'] = ($item->user && $item->status > 0)?$item->user->getShowName():''; + $row['submit_user'] = $order_info->user ? $order_info->user->getShowName():''; $row['status'] = $item->getStatus(); $row['use_num'] = $gift_info->use_num; $data['rows'][] = $row; @@ -968,4 +1095,115 @@ class GiftController extends \yii\web\Controller return $data; } + public function actionTicketUseEdit() + { + $request = Yii::$app->request; + $id = $request->get('id',0); + $back_params = $request->get('back_params'); + if($id > 0) { + $info = GiftTicketTUse::findOne(['id'=>$id]); + } else { + $info = new GiftTicketTUse(); + } + + + + return $this->render('ticket-use-edit',[ + 'info' => $info + ]); + } + public function actionHistoryLogJson() + { + Yii::$app->response->format = Response::FORMAT_JSON; + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $id = $request->get('id'); + $offset = $request->get('offset', 0); + $limit = $request->get('limit', 10); + + $query = GiftUseLogT::find() + ->where('gift_use_id='.$id) + ->orderBy('op_time DESC'); + + $total = $query->count(); + + $query->offset($offset)->limit($limit); + $items = $query->all(); + + $data = []; + $data['total'] = $total; + $data['rows'] = []; + foreach($items as $item) { + $row = $item->toArray(); + $row['op_time'] = date('Y-m-d H:i:s', $item->op_time); + $data['rows'][] = $row; + } + + return $data; + } + public function actionUseSave() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $result = array(); + $result['success'] = false; + $result['msg'] = '保存失败'; + + if($request->isPost) { + $id = $request->post('id'); + $remark = $request->post('remark'); + + $tran = GiftTicketTUse::getDb()->beginTransaction(); + try { + $ticket_info = GiftTicketTUse::findOne(['id'=>$id]); + if(!$ticket_info) { + $result['msg'] = '礼品券不存在!'; + return $result; + } + + $use_num = $ticket_info->typeNew->use_num; + $finished_num = $ticket_info->finished_num + 1; + $ticket_info->user_id = $this->my->id; + $ticket_info->finished_num = $finished_num; + $ticket_info->finished_date = date('Y-m-d'); + $ticket_info->use_date = date('Y-m-d H:i:s'); + + if($finished_num < $use_num){ + $ticket_info->status = 2; + }elseif ($finished_num >= $use_num){ + $ticket_info->status = 3; + } + + if(!$ticket_info->save()) { + throw new \Exception(print_r($ticket_info->getErrors(), true)); + } + + $this->addGiftUseLog($id,'使用了一次',$remark); + $result['success'] = true; + $result['msg'] = '保存成功'; + + $tran->commit(); + } catch (\Exception $e) { + $tran->rollBack(); + $result['msg'] = $e->getMessage(); + } + + } + return $result; + } + + public function addGiftUseLog($id,$info,$remark,$type=1) + { + $log_info = new GiftUseLogT(); + $log_info->gift_use_id = $id; + $log_info->op_time = time(); + $log_info->op_man = $this->my->getShowName(); + $log_info->group_name = $this->my->group?$this->my->group->getPath():''; + $log_info->type = $type; + $log_info->remark = $remark; + $log_info->info = $info; + if(!$log_info->save()) { + throw new \Exception(print_r($log_info->getErrors(), true)); + } + } } diff --git a/frontend/controllers/GiftGroupController.php b/frontend/controllers/GiftGroupController.php deleted file mode 100644 index 9ddcd35..0000000 --- a/frontend/controllers/GiftGroupController.php +++ /dev/null @@ -1,141 +0,0 @@ -request->cookies; - $user_id = MyLib::encrypt($cookie->get('aid'),'DECODE'); - - if($user_id != 0) - { - $this->my = UserT::findOne(['id'=>$user_id]); - } else { - Yii::$app->response->redirect('/common/login')->send(); - exit; - } - } - - public function actionIndex() - { - $request = Yii::$app->request; - $name = $request->get('name'); - - $query = GiftGroupT::find() - ->orderBy('id ASC') - ->where('id>0'); - if($name != '') { - $query = $query->andWhere('name like "'.$name.'%"'); - } - $total = $query->count(); - - $items = $query->all(); - - return $this->render('index',[ - 'items' => $items, - 'name' => $name - ]); - } - - public function actionEdit() - { - $request = Yii::$app->request; - $id = $request->get('id',0); - $info = GiftGroupT::findOne(['id'=>$id]); - if(!$info) - $info = new GiftGroupT(); - $gifts = $info->gifts; - $gift_ids = array(); - if($gifts) { - foreach($gifts as $gift) { - $gift_ids[] = $gift->id; - } - } - - $gift_items = GiftType3T::find()->all(); - - return $this->render('edit',[ - 'info'=>$info, - 'gift_ids'=>$gift_ids, - 'gift_items'=>$gift_items - ]); - } - - public function actionSave() { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - if($request->isPost) { - $id = intval($request->post('id')); - $name = $request->post('name'); - $is_free = $request->post('is_free',0); - $is_damage = $request->post('is_damage',0); - $gift_ids = $request->post('gift_ids'); - $gift_str = join(',',$gift_ids); - $min_money = $request->post('min_money'); - $max_money = $request->post('max_money'); - $group_ids = $request->post('group_ids'); - - $row = null; - if($id > 0) { - $row = GiftGroupT::findOne(['id'=>$id]); - } else { - $row = new GiftGroupT(); - } - $row->name = $name; - $row->is_free = $is_free; - $row->is_damage = $is_damage; - $row->gift_ids = $gift_str; - $row->min_money = $min_money; - $row->max_money = $max_money; - $row->group_ids = $group_ids; - if(!$row->save()) { - var_dump($row->errors); - } - - $result['success'] = true; - $result['msg'] = '操作成功'; - return $result; - } - $result['success'] = false; - $reuslt['msg'] = '操作失败'; - return $result; - } - - public function actionDelete() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '删除失败'; - - if($request->isPost) { - $id = $request->post('id',0); - - if($id > 0) { - $row = GiftGroupT::findOne(['id'=>$id]); - $row->delete(); - - $result['success'] = true; - $result['msg'] = '删除成功'; - } - } - return $result; - } -} diff --git a/frontend/controllers/GiftTypeController.php b/frontend/controllers/GiftTypeController.php deleted file mode 100644 index d975671..0000000 --- a/frontend/controllers/GiftTypeController.php +++ /dev/null @@ -1,298 +0,0 @@ -request->cookies; - $user_id = MyLib::encrypt($cookie->get('aid'),'DECODE'); - - if($user_id != 0) - { - $this->my = UserT::findOne(['id'=>$user_id]); - } else { - Yii::$app->response->redirect('/common/login')->send(); - exit; - } - } - - public function actionIndex() - { - $request = Yii::$app->request; - $name = $request->get('name'); - - $query = GiftTypeT::find(); - if($name != '') { - $query = $query->andWhere(['like','name',$name]); - } - $items = $query->all(); - - return $this->render('index',[ - 'items' => $items, - 'name' => $name - ]); - } - - public function actionEdit() - { - $request = Yii::$app->request; - $id = $request->get('id',0); - if($id > 0) { - $info = GiftTypeT::findOne(['id'=>$id]); - } else { - $info = new GiftTypeT(); - } - - 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) { - $id = $request->post('id',0); - $name = $request->post('name'); - - if($name == '') { - $result['msg'] = '请输入名称!'; - return $result; - } - - $row = null; - if($id > 0) { - $row = GiftTypeT::findOne(['id'=>$id]); - } else { - $row = new GiftTypeT(); - } - $row->name = $name; - $row->save(); - - $result['success'] = true; - $result['msg'] = '保存成功'; - } - return $result; - } - - public function actionDelete() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '删除失败'; - - if($request->isPost) { - $id = $request->post('id',0); - - if($id > 0) { - $row = GiftTypeT::findOne(['id'=>$id]); - $row->delete(); - - $result['success'] = true; - $result['msg'] = '删除成功'; - } - } - return $result; - } - - public function actionType2List() - { - $request = Yii::$app->request; - $name = $request->get('name'); - - $query = GiftType2T::find(); - if($name != '') { - $query = $query->andWhere(['like','name',$name]); - } - $items = $query->all(); - - return $this->render('type2-list',[ - 'items' => $items, - 'name' => $name - ]); - } - - public function actionType2Edit() - { - $request = Yii::$app->request; - $id = $request->get('id',0); - if($id > 0) { - $info = GiftType2T::findOne(['id'=>$id]); - } else { - $info = new GiftType2T(); - } - - return $this->render('type2-edit',[ - 'info' => $info - ]); - } - - public function actionType2Save() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '保存失败'; - - if($request->isPost) { - $id = $request->post('id',0); - $name = $request->post('name'); - - if($name == '') { - $result['msg'] = '请输入名称!'; - return $result; - } - - $row = null; - if($id > 0) { - $row = GiftType2T::findOne(['id'=>$id]); - } else { - $row = new GiftType2T(); - } - $row->name = $name; - $row->save(); - - $result['success'] = true; - $result['msg'] = '保存成功'; - } - return $result; - } - - public function actionType2Delete() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '删除失败'; - - if($request->isPost) { - $id = $request->post('id',0); - - if($id > 0) { - $row = GiftType2T::findOne(['id'=>$id]); - $row->delete(); - - $result['success'] = true; - $result['msg'] = '删除成功'; - } - } - return $result; - } - - public function actionType3List() - { - $request = Yii::$app->request; - $name = $request->get('name'); - - $query = GiftType3T::find(); - if($name != '') { - $query = $query->andWhere(['like','name',$name]); - } - $items = $query->all(); - - return $this->render('type3-list',[ - 'items' => $items, - 'name' => $name - ]); - } - - public function actionType3Edit() - { - $request = Yii::$app->request; - $id = $request->get('id',0); - if($id > 0) { - $info = GiftType3T::findOne(['id'=>$id]); - } else { - $info = new GiftType3T(); - } - - return $this->render('type3-edit',[ - 'info' => $info - ]); - } - - public function actionType3Save() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '保存失败'; - - if($request->isPost) { - $id = $request->post('id',0); - $name = $request->post('name'); - $price = $request->post('price',0); - $total = $request->post('total',-1); - $type = $request->post('type',0); - - if($name == '') { - $result['msg'] = '请输入名称!'; - return $result; - } - - $row = null; - if($id > 0) { - $row = GiftType3T::findOne(['id'=>$id]); - } else { - $row = new GiftType3T(); - } - $row->name = $name; - $row->price = $price; - $row->total = $total; - $row->type = $type; - if(!$row->save()) { - var_dump($row->errors); - } - - $result['success'] = true; - $result['msg'] = '保存成功'; - } - return $result; - } - - public function actionType3Delete() - { - Yii::$app->response->format = Response::FORMAT_JSON; - $request = Yii::$app->request; - $result = array(); - $result['success'] = false; - $result['msg'] = '删除失败'; - - if($request->isPost) { - $id = $request->post('id',0); - - if($id > 0) { - $row = GiftType3T::findOne(['id'=>$id]); - $row->delete(); - - $result['success'] = true; - $result['msg'] = '删除成功'; - } - } - return $result; - } -} diff --git a/frontend/controllers/InsurerController.php b/frontend/controllers/InsurerController.php index b060730..dddef3c 100644 --- a/frontend/controllers/InsurerController.php +++ b/frontend/controllers/InsurerController.php @@ -26,9 +26,11 @@ use common\models\ExpressT; use common\models\GiftGroupT; use common\models\GiftT; use common\models\GiftTicketT; +use common\models\GiftTicketTUse; use common\models\GiftType2T; use common\models\GiftType3T; use common\models\GroupT; +use common\models\InsurerCompany2T; use common\models\InsurerCompanyT; use common\models\InsurerTypeT; use common\models\InvalidT; @@ -50,8 +52,10 @@ use common\models\SeriesT; use common\models\UserT; use common\models\CaiwuStatusT; use common\models\ZhongjiGiftT; +use Faker\Provider\Image; use Yii; use yii\data\Pagination; +use yii\helpers\FileHelper; use yii\web\Response; use yii\web\User; use yii\helpers\ArrayHelper; @@ -116,104 +120,76 @@ class InsurerController extends BaseController ]); } -// public function actionInfo() -// { -// $request = Yii::$app->request; -// $id = $request->get('id',0); -// $order_info = OrderT::findOne(['id'=>$id]); -// $car_info = $order_info->car; -// $nonitems=null; -// if($order_info->non_id){ -// $nonitems=NonAutoInsurance::findOne(['id'=>$order_info->non_id]); -// } -// -// //快递 -// $ems_items = EmsT::find() -// ->where(['car_id'=>$car_info->id,'order_id'=>$order_info->id]) -// ->orderBy('id ASC') -// ->all(); -// //礼品 -// $gift_free_group_items = GiftGroupT::find() -// ->where('is_free=1') -// ->all(); -// $gift_group_items = GiftGroupT::find() -// ->where('is_free=0') -// ->all(); -// //获取礼品数据 -// $sel_gifts = array(); -// $tmp_items = OrderGiftT::find() -// ->where('order_id='.$order_info->id) -// ->all(); -// foreach($tmp_items as $item) { -// $sel_gifts[$item->group_id] = $item; -// } -// -// $insurer_type_items = InsurerTypeT::find() -// ->all(); -// //登陆用户ID -// $uid = $this->my->id; -// $order_caiwu = OrderCaiwuT::findOne(['order_id'=>$order_info->id]); -// $money_man=''; -// $money_no=''; -// $money_bank=''; -// if($order_caiwu){ -// $money_man=$order_caiwu->money_man; -// $money_no= $order_caiwu->money_no; -// $money_bank=$order_caiwu->money_bank; -// } -// return $this->render('info',[ -// 'order_info'=>$order_info, -// 'car_info'=>$car_info, -// 'ems_items' => $ems_items, -// 'money_man' => $money_man, -// 'money_no' => $money_no, -// 'money_bank' => $money_bank, -// 'gift_free_group_items' => $gift_free_group_items, -// 'gift_group_items' => $gift_group_items, -// 'sel_gifts' => $sel_gifts, -// 'uid' => $uid, -// 'insurer_type_items' => $insurer_type_items, -// 'nonitems' => $nonitems -// ]); -// } - - public function actionInfo() { - return $this->render('info'); - } - - public function actionInfoJson() + public function actionInfo() { - Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; $id = $request->get('id',0); $order_info = OrderT::findOne(['id'=>$id]); - + $car_info = $order_info->car; + $nonitems=null; if($order_info->non_id){ $nonitems=NonAutoInsurance::findOne(['id'=>$order_info->non_id]); } - +// dd($order_info->non_id); + //快递 +// dd($car_info->id); +// $ems_items = EmsT::find() +// ->where(['car_id'=>$car_info->id,'order_id'=>$order_info->id]) +// ->orderBy('id ASC') +// ->all(); +// $ems_items1=(object)array(); +// if(!$ems_items){ +// $ems_items1 = ExpressT::find() +// ->where(['car_id'=>$car_info->id,'order_id'=>$order_info->id]) +// ->orderBy('id ASC') +// ->all(); +// } + //礼品 + $gift_free_group_items = GiftGroupT::find() + ->where('is_free=1') + ->all(); + $gift_group_items = GiftGroupT::find() + ->where('is_free=0') + ->all(); //获取礼品数据 - $order_gifts = OrderGiftT::find() + $sel_gifts = array(); + $tmp_items = OrderGiftT::find() ->where('order_id='.$order_info->id) ->all(); + foreach($tmp_items as $item) { + $sel_gifts[$item->group_id] = $item; + } - $insurer_type_items = InsurerTypeT::find()->all(); + $insurer_type_items = InsurerTypeT::find() + ->all(); //登陆用户ID $uid = $this->my->id; $order_caiwu = OrderCaiwuT::findOne(['order_id'=>$order_info->id]); - - return MyLib::ok3([ - 'order_info'=>MyLib::GetOrderInfoResponse($order_info), - 'car_info'=>MyLib::GetCarInfoResponse($order_info->car), - 'insurer_type_info' => MyLib::GetInfosResponse('insurer_type',$insurer_type_items,$order_info->id), - 'gift_info' => MyLib::GetInfosResponse('gift',$order_gifts), - 'order_insurer_info' => $order_caiwu, + $money_man=''; + $money_no=''; + $money_bank=''; + if($order_caiwu){ + $money_man=$order_caiwu->money_man; + $money_no= $order_caiwu->money_no; + $money_bank=$order_caiwu->money_bank; + } + return $this->render('info',[ + 'order_info'=>$order_info, + 'car_info'=>$car_info, +// 'ems_items' => $ems_items, +// 'ems_items1' => $ems_items1, + 'money_man' => $money_man, + 'money_no' => $money_no, + 'money_bank' => $money_bank, + 'gift_free_group_items' => $gift_free_group_items, + 'gift_group_items' => $gift_group_items, + 'sel_gifts' => $sel_gifts, 'uid' => $uid, + 'insurer_type_items' => $insurer_type_items, 'nonitems' => $nonitems ]); } - public function actionSave() { Yii::$app->response->format = Response::FORMAT_JSON; @@ -438,54 +414,6 @@ class InsurerController extends BaseController return $data; } -// public function actionMyListInfo() -// { -// $request = Yii::$app->request; -// $id = $request->get('id',0); -// $order_info = OrderT::findOne(['id'=>$id]); -// $car_info = $order_info->car; -// -// //快递 -// $ems_items = EmsT::find() -// ->where(['car_id'=>$car_info->id,'order_id'=>$order_info->id]) -// ->orderBy('id ASC') -// ->all(); -// //礼品 -// $gift_items = GiftT::find() -// ->where('type_id=1') -// ->all(); -// //礼品 -// $gift_group_items = GiftGroupT::find()->all(); -// //获取礼品数据 -// $sel_gifts = array(); -// $tmp_items = OrderGiftT::find() -// ->where('order_id='.$order_info->id) -// ->all(); -// foreach($tmp_items as $item) { -// $sel_gifts[$item->group_id] = $item; -// } -// -// $insurer_type_items = InsurerTypeT::find() -// ->all(); -// -// //登陆用户ID -// $uid = $this->my->role_id; -// //转账信息 -// $caiwu_status = CaiwuStatusT::find()->asArray()->all(); -// $caiwu_status= ArrayHelper::map($caiwu_status,'id', 'name'); -// -// return $this->render('my-list-info',[ -// 'car_info' => $car_info, -// 'caiwu_status' => $caiwu_status, -// 'insurer_type_items' => $insurer_type_items, -// 'order_info' => $order_info, -// 'ems_items' => $ems_items, -// 'uid' => $uid, -// 'gift_items' => $gift_items, -// 'gift_group_items' => $gift_group_items, -// 'sel_gifts' => $sel_gifts, -// ]); -// } public function actionMyListInfo() { $request = Yii::$app->request; @@ -525,6 +453,7 @@ class InsurerController extends BaseController //登陆用户ID $uid = $this->my->role_id; + $my_id = $this->my->id; //转账信息 $caiwu_status = CaiwuStatusT::find()->asArray()->all(); $caiwu_status= ArrayHelper::map($caiwu_status,'id', 'name'); @@ -537,6 +466,7 @@ class InsurerController extends BaseController 'ems_items' => $ems_items, 'ems_items1' => $ems_items1, 'uid' => $uid, + 'my_id' => $my_id, 'gift_items' => $gift_items, 'gift_group_items' => $gift_group_items, 'sel_gifts' => $sel_gifts, @@ -638,29 +568,44 @@ class InsurerController extends BaseController * @return string */ public function actionOfficeMng() { - return $this->render('office-mng'); + $insurer_company_items = InsurerCompanyT::find()->all(); + + return $this->render('office-mng',[ + 'insurer_company_items' => $insurer_company_items + ]); } public function actionOfficeMngJson() { Yii::$app->response->format = Response::FORMAT_JSON; $request = Yii::$app->request; + $type = $request->get('type'); $car_man = $request->get('car_man'); $phone = $request->get('phone'); $car_no = $request->get('car_no'); + $company2_id = $request->get('company2_id'); $offset = $request->get('offset', 0); $limit = $request->get('limit', 10); $query = OrderT::find() ->where('status_id=2') ->orderBy('submit_date DESC, id DESC'); + if($type == 1) { + $query->andWhere('lock_id=0'); + } + if($type == 2) { + $query->andWhere('lock_id>0'); + } if($car_man != '') { - $query = $query->andWhere('car_man="'.$car_man.'"'); + $query->andWhere('car_man="'.$car_man.'"'); } if($phone != '') { - $query = $query->andWhere('link_phone="'.$phone.'"'); + $query->andWhere('car_man_phone like :phone1 or id_man_phone like :phone2 or link_man_phone like :phone3',[':phone1'=>$phone,':phone2'=>$phone,':phone3'=>$phone]); } if($car_no != '') { - $query = $query->andWhere('car_no="'.$car_no.'"'); + $query->andWhere('car_no="'.$car_no.'"'); + } + if($company2_id > 0) { + $query->andWhere('company2_id=:company2_id',[':company2_id'=>$company2_id]); } $query = $query->orderBy('updated_at asc'); $total = $query->count(); @@ -673,7 +618,7 @@ class InsurerController extends BaseController $data['rows'] = []; foreach($items as $item) { $row = $item->toArray(); - $row['company_name'] = $item->company2?$item->company2->name:''; + $row['company_name'] = $item->company?$item->company->name:''; $row['factory_model'] = $item->car?$item->car->factory_model:''; $row['user_name'] = $item->user?$item->user->getShowName():''; $row['status_name'] = $item->status->name; @@ -722,7 +667,7 @@ class InsurerController extends BaseController $insurer_type_items = InsurerTypeT::find() ->all(); - $insurer_company_items = InsurerCompanyT::find() + $insurer_company2_items = InsurerCompany2T::find() ->all(); $payee_items=PayeeT::find()->all(); $payment_items=Payment::find()->all(); @@ -731,10 +676,9 @@ class InsurerController extends BaseController 'car_info' => $car_info, 'insurer_type_items' => $insurer_type_items, 'order_info' => $order_info, - 'insurer_company_items' => $insurer_company_items, + 'insurer_company2_items' => $insurer_company2_items, 'payee_items' => $payee_items, 'payment_items' => $payment_items, - 'type_items' => $type_items ]); } /** @@ -798,7 +742,7 @@ class InsurerController extends BaseController $total1_rate = $request->post('total1_rate','0.00'); $total2_rate = $request->post('total2_rate','0.00'); $pay_no = $request->post('pay_no',0); - $company_id = $request->post('company_id',0); + $company2_id = $request->post('company2_id',0); if($total1_rate == '') { $result['msg'] = '请输入商业跟单手续费!'; @@ -808,7 +752,7 @@ class InsurerController extends BaseController $result['msg'] = '请输入交强跟单手续费!'; return $result; } - if($company_id == 0) { + if($company2_id == 0) { $result['msg'] = '请选择保险公司!'; return $result; } @@ -824,57 +768,22 @@ class InsurerController extends BaseController $result['msg'] = '保单错误!'; return $result; } - //更新车辆车牌号 - $car_info = $order_info->car; - $car_info->car_no = $order_info->car_no; - $car_info->save(); $old_status_id = $order_info->status_id; $order_info->total1_rate = $total1_rate; $order_info->total2_rate = $total2_rate; - $order_info->company_id = $company_id; - $order_info->payee_id = $payee_id; - $order_info->payment_id = $payment_id; - $order_info->zhifu_date = date('Y-m-d'); + $order_info->company2_id = $company2_id; $order_info->pay_no = $pay_no; $order_info->status_id = $status_id; - //如果是在线支付和自上门,更改订单状态 - - -// echo '
';
-//                print_r($old_status_id);
-//                echo '
'; -// print_r($status_id); -// die; - - - + $result['msg'] = '保存成功'; if($status_id > $old_status_id) { -// if($order_info->shoufei_id ==2 || $order_info->shoufei_id ==3){ -// -// $order_info->status_id = 5; -// } $order_info->op1_id = $this->my->id; -// echo '
'; - $order_info->lock_id = 0; -// if($order_info->shoufei_id ==2){ -// $this->addLog($car_id,'核保结束,在线支付,直接进入正本生成',1); -//// echo 1; -// }elseif( $order_info->shoufei_id ==3){ -// $this->addLog($car_id,'核保结束,客户自上门,直接进入正本生成',1); -//// echo 2; -// } else{ - $this->addLog($car_id,'核保结束,进入正本生成',1); -// echo 3; -// } -// echo '
'; -// print_r($order_info->status_id); -// print_r($status_id); -// print_r($old_status_id); -// die; +// $order_info->lock_id = 0; + $result['msg'] = '提交成功'; + $this->addLog($car_id,'核保结束,进入正本生成',1); //处理操作人员状态 $order_user_info = OrderUserT::findOne(['order_id'=>$order_info->id,'user_id'=>$this->my->id,'type_id'=>$old_status_id,'status'=>0]); @@ -883,17 +792,16 @@ class InsurerController extends BaseController $order_user_info->save(); } } - $order_info->save(); + if(!$order_info->save()) { + throw new \Exception(print_r($order_info->getErrors(), true)); + } + $result['success'] = true; $tran->commit(); - } catch(\Exception $e) { $tran->rollBack(); - throw $e; + $result['msg'] = $e->getMessage(); } - - $result['success'] = true; - $result['msg'] = '保存成功'; } return $result; } @@ -1150,7 +1058,11 @@ class InsurerController extends BaseController * @return string */ public function actionOriginalMng() { - return $this->render('original-mng'); + $pay_type_items = PayTypeT::find()->all(); + + return $this->render('original-mng',[ + 'pay_type_items' => $pay_type_items + ]); } public function actionOriginalMngJson() { @@ -1159,9 +1071,7 @@ class InsurerController extends BaseController $id_man = $request->get('id_man'); $phone = $request->get('phone'); $car_no = $request->get('car_no'); - $send_date = $request->get('send_date'); - $payee_id = $request->get('payee_id'); - $payment_id = $request->get('payment_id'); + $pay_type_id = $request->get('pay_type_id'); $offset = $request->get('offset',0); $limit = $request->get('limit',10); @@ -1169,27 +1079,21 @@ class InsurerController extends BaseController ->where('status_id=5') ->orderBy('submit_date DESC, id DESC'); if($id_man != '') { - $query = $query->andWhere('id_man="'.$id_man.'"'); + $query->andWhere('id_man="'.$id_man.'"'); } if($phone != '') { - $query = $query->andWhere('link_phone="'.$phone.'"'); + $query->andWhere('car_man_phone like :phone1 or id_man_phone like :phone2 or link_man_phone like :phone3',[':phone1'=>$phone,':phone2'=>$phone,':phone3'=>$phone]); } if($car_no != '') { - $query = $query->andWhere('car_no="'.$car_no.'"'); - } - if($send_date != '') { - $query = $query->andWhere('send_date="'.$send_date.'"'); - } - if($payee_id != '') { - $query = $query->andWhere('payee_id="'.$payee_id.'"'); + $query->andWhere('car_no=:car_no',[':car_no'=>$car_no]); } - if($payment_id != '') { - $query = $query->andWhere('payment_id="'.$payment_id.'"'); + if($pay_type_id > 0) { + $query->andWhere('pay_type_id=:pay_type_id',[':pay_type_id'=>$pay_type_id]); } - $query = $query->orderBy('updated_at ASC'); + $query->orderBy('updated_at ASC'); $total = $query->count(); - $query = $query->offset($offset)->limit($limit); + $query->offset($offset)->limit($limit); $items = $query->all(); $data = []; @@ -1197,7 +1101,7 @@ class InsurerController extends BaseController $data['rows'] = []; foreach($items as $item) { $row = $item->toArray(); - $row['company_name'] = $item->company->name; + $row['company_name'] = $item->company2->name; $row['user_name'] = $item->user?$item->user->getShowName():''; $row['status_name'] = $item->status->name; $row['pay_type'] = ($item->shoufei_id?MyLib::zhifufs($item->shoufei_id).'-':'').' '.($item->payType?$item->payType->name:''); @@ -1254,17 +1158,11 @@ class InsurerController extends BaseController $insurer_company_items = InsurerCompanyT::find() ->all(); - $type_items = GiftType2T::find()->all(); - $payee_items=PayeeT::find()->all(); - $payment_items=Payment::find()->all(); return $this->render('original-mng-edit',[ 'car_info' => $car_info, 'insurer_type_items' => $insurer_type_items, 'order_info' => $order_info, - 'insurer_company_items' => $insurer_company_items, - 'payee_items' => $payee_items, - 'payment_items' => $payment_items, - 'type_items' => $type_items + 'insurer_company_items' => $insurer_company_items ]); } /** @@ -1349,6 +1247,7 @@ class InsurerController extends BaseController $row->car_no = $order_info->car_no; $row->factory_model = $order_info->car->factory_model; $row->id_man = $order_info->id_man; + $row->company = $order_info->company2->name; $row->total = sprintf("%.2f",$order_info->total1); $row->total_clear = sprintf("%.2f",$order_info->total1_clear); $row->total_clear_real = sprintf("%.2f",($order_info->total1_clear * $order_info->total1_rate/100)); @@ -1373,6 +1272,7 @@ class InsurerController extends BaseController $row->insurer_no = $order_info->insurer2_no; $row->car_no = $order_info->car_no; $row->factory_model = $order_info->car->factory_model; + $row->company = $order_info->company2->name; $row->id_man = $order_info->id_man; $row->total = sprintf("%.2f",$order_info->total2); $row->total_clear = sprintf("%.2f",$order_info->total2_clear); @@ -1436,6 +1336,7 @@ class InsurerController extends BaseController //更新保险日期 $car_info->insurer1_date = $order_info->insurer1_end_date; $car_info->insurer2_date = $order_info->insurer2_end_date; + $car_info->company = $order_info->company->name; //续保次数 $car_info->xubao_num=intval($car_info->xubao_num)+1; if(!$car_info->save()) { @@ -2499,109 +2400,6 @@ class InsurerController extends BaseController * 出纳办结-列表 * @return string */ -// public function actionFinanceMng() -// { -// $request = Yii::$app->request; -// //新增正本日期 -// $begin_date = $request->get('begin_date'); -// $end_date = $request->get('end_date'); -// //新增完成状态 -// $status = $request->get('status'); -// -// $car_man = $request->get('car_man'); -// $phone = $request->get('phone'); -// $car_no = $request->get('car_no'); -// $send_date = $request->get('send_date'); -// $insurer_no = $request->get('insurer_no'); -// $caiwu_status_id = $request->get('caiwu_status_id'); -// $page = $request->get('page',1); -// if($page < 1) $page = 1; -// -// $query = OrderT::find() -// ->leftJoin('order_caiwu_t','order_caiwu_t.order_id=order_t.id') -// ->where('order_caiwu_t.status_id>0') -// ->orderBy('order_t.print_date asc'); -// if($car_man != '') { -// $query = $query->andWhere('id_man="'.$car_man.'"'); -// } -// if($phone != '') { -// $query = $query->andWhere('link_phone="'.$phone.'"'); -// } -// if($car_no != '') { -// $query = $query->andWhere('car_no="'.$car_no.'"'); -// } -// if($send_date != '') { -// $query = $query->andWhere('send_date="'.$send_date.'"'); -// } -// if($insurer_no != '') { -// $query = $query->andWhere('(insurer1_no="'.$insurer_no.'" or insurer2_no="'.$insurer_no.'")'); -// } -// //添加正本日期 -// if($begin_date != '') { -// $query = $query->andWhere('print_date>="'.$begin_date.'"'); -// } -// if($end_date != '') { -// $query = $query->andWhere('print_date<="'.$end_date.'"'); -// } -// //添加完成状态 -// if($status == 2) { -// $query = $query->andWhere('order_caiwu_t.status_id=10 or order_caiwu_t.status_id=13'); -// } else if($status == 1) { -// $query = $query->andWhere('order_caiwu_t.status_id=12'); -// } else { -// $query = $query->andWhere('order_caiwu_t.status_id=13 or order_caiwu_t.status_id=10 or order_caiwu_t.status_id=12'); -// } -// //转账状态 -// if($caiwu_status_id > 0){ -// switch($caiwu_status_id){ -// case 1: -// $query = $query->andWhere('order_caiwu_t.caiwu_status_id=1'); -// break; -// case 2: -// $query = $query->andWhere('order_caiwu_t.caiwu_status_id=2'); -// break; -// case 3: -// $query = $query->andWhere('order_caiwu_t.caiwu_status_id=3'); -// break; -// case 4: -// $query = $query->andWhere('order_caiwu_t.caiwu_status_id=4'); -// break; -// default: -// break; -// } -// } -//// if($this->my->username == 'admin') -//// echo $query->createCommand()->rawSql; -//// echo $query->createCommand()->rawSql; -//// die; -// $total = $query->count(); -// -// $pagination = new Pagination(['totalCount' => $total,'pageSize'=>20]); -// $pagination->setPage($page-1); -// -// $query = $query->offset($pagination->offset)->limit($pagination->limit); -// $items = $query->all(); -// -// $page_info = MyLib::getPageInfo($pagination); -// -// $caiwu_status = CaiwuStatusT::find()->all(); -// -// return $this->render('finance-mng',[ -// 'items' => $items, -// 'car_man' => $car_man, -// 'phone' => $phone, -// 'car_no' => $car_no, -// 'send_date' => $send_date, -// 'page' => $page, -// 'page_info' => $page_info, -// 'insurer_no' => $insurer_no, -// 'status' => $status, -// 'caiwu_status_id' => $caiwu_status_id, -// 'caiwu_status' => $caiwu_status, -// 'begin_date' => $begin_date, -// 'end_date' => $end_date -// ]); -// } public function actionFinanceMng() { return $this->render('finance-mng'); } @@ -2725,7 +2523,15 @@ class InsurerController extends BaseController $data['rows'] = []; foreach($items as $item) { $row = $item->toArray(); - $row['user'] = $item->user?$item->user->getShowName():''; + $row['company_name'] = $item->company2->name; + $row['path'] = ($item->user && $item->user->group) ? $item->user->group->getPath():''; + $row['user_name'] = $item->user?$item->user->getShowName():''; + $row['total_user_real'] = number_format($item->total1_dis + $item->yuangong_money,2); + $row['transfer_date'] = $item->caiwu->transfer_date; + $row['caiwu_status_name'] = $item->caiwu->caiwuStatus->name; + $row['shoufei_name'] = MyLib::zhifufs($item->shoufei_id); + $row['status_name'] = $item->caiwu->status->name; + $row['lock_man'] = $item->caiwu->lock?$item->caiwu->lock->getShowName():''; $data['rows'][] = $row; } @@ -2902,7 +2708,6 @@ class InsurerController extends BaseController $order_info = OrderT::findOne(['id'=>$id]); $car_info = $order_info->car; $caiwu_info = $order_info->caiwu; - if($caiwu_info->lock_id == 0) { $tran = OrderCaiwuT::getDb()->beginTransaction(); try { @@ -2963,10 +2768,12 @@ class InsurerController extends BaseController $tmp_row = PriceT::find() ->where('order_id='.$order_id.' and type_id='.$v->id) ->one(); - if($tmp_row->val != '' && $tmp_row->val != '0' && $tmp_row->val != '否' && $tmp_row->val != '无'){ - $new_array[$k]['zl'] = $v->name.'('.$v->code.')'; - $new_array[$k]['neir'] = $tmp_row->val; - $new_array[$k]['bjmp'] = $tmp_row->is_nopay==1?'是':''; + if($tmp_row) { + if ($tmp_row->val != '' && $tmp_row->val != '0' && $tmp_row->val != '否' && $tmp_row->val != '无') { + $new_array[$k]['zl'] = $v->name . '(' . $v->code . ')'; + $new_array[$k]['neir'] = $tmp_row->val; + $new_array[$k]['bjmp'] = $tmp_row->is_nopay == 1 ? '是' : ''; + } } } @@ -3175,33 +2982,8 @@ class InsurerController extends BaseController $transfer_money = $request->post('transfer_money'); $transfer_bank_id = $request->post('transfer_bank_id'); $transfer_bank_no = $request->post('transfer_bank_no'); - $budian_rate = $request->post('budian_rate'); - $budian_money = $request->post('budian_money'); - $business_back_money = $request->post('business_back_money'); - $business_back_rate = $request->post('business_back_rate'); - $business_back_routine = $request->post('business_back_routine'); - $business_back_date = $request->post('business_back_date'); - $force_back_money = $request->post('force_back_money'); - $force_back_rate = $request->post('force_back_rate'); - $force_back_routine = $request->post('force_back_routine'); - $force_back_date = $request->post('force_back_date'); $caiwu_no = $request->post('caiwu_no'); - $rate1 = $request->post('rate1'); - $money1 = $request->post('money1'); - $rate2 = $request->post('rate2'); - $money2 = $request->post('money2'); - $rate3 = $request->post('rate3'); - $money3 = $request->post('money3'); - $rate4 = $request->post('rate4'); - $money4 = $request->post('money4'); - $rate5 = $request->post('rate5'); - $money5 = $request->post('money5'); - $send_rate = $request->post('send_rate'); - $send_money = $request->post('send_money'); $caiwu_status_id = $request->post('caiwu_status_id'); - $gift_ids = $request->post('gift_ids',array()); - $gift_prices = $request->post('gift_prices',array()); - $gift_rates = $request->post('gift_rates',array()); $tran = OrderCaiwuT::getDb()->beginTransaction(); try { @@ -3219,213 +3001,36 @@ class InsurerController extends BaseController $caiwu_info->transfer_money = $transfer_money; $caiwu_info->transfer_bank_id = $transfer_bank_id; $caiwu_info->transfer_bank_no = $transfer_bank_no; - $caiwu_info->budian_rate = $budian_rate; - $caiwu_info->budian_money = $budian_money; - $caiwu_info->business_back_money = $business_back_money; - $caiwu_info->business_back_rate = $business_back_rate; - $caiwu_info->business_back_routine = $business_back_routine; - $caiwu_info->business_back_date = $business_back_date; - $caiwu_info->force_back_money = $force_back_money; - $caiwu_info->force_back_rate = $force_back_rate; - $caiwu_info->force_back_routine = $force_back_routine; - $caiwu_info->force_back_date = $force_back_date; $caiwu_info->caiwu_no = $caiwu_no; $old_status_id = $caiwu_info->status_id; - if($status_id > $old_status_id) { + if($status_id == 10) { + if($caiwu_status_id == 0){ + $result['success'] = false; + $result['msg'] = '请先确定转账状态后,再点提交按钮!'; + return $result; + } if($caiwu_info->caiwu_status_id != $caiwu_status_id) { $result['success'] = false; $result['msg'] = '请先保存成功后,再点提交按钮!'; return $result; } + + $caiwu_info->lock_id = 0; + $this->addLog($caiwu_info->order->car_id,'返现管理完成',1); } $caiwu_info->caiwu_status_id = $caiwu_status_id; - $caiwu_info->rate1 = $rate1; - $caiwu_info->money1 = $money1; - $caiwu_info->rate2 = $rate2; - $caiwu_info->money2 = $money2; - $caiwu_info->rate3 = $rate3; - $caiwu_info->money3 = $money3; - $caiwu_info->rate4 = $rate4; - $caiwu_info->money4 = $money4; - $caiwu_info->rate5 = $rate5; - $caiwu_info->money5 = $money5; - $caiwu_info->send_rate = $send_rate; - $caiwu_info->send_money = $send_money; -// $caiwu_info->send_price = $send_price; - $caiwu_info->status_id = $status_id; - $caiwu_info->save(); -// echo $caiwu_info->lock_id."\r\n"; -// echo $status_id; -// exit; - //保存礼品价格 - foreach($gift_ids as $index => $id) { - $rate = $gift_rates[$index]; - $price = $gift_prices[$index]; - $order_gift = OrderGiftT::findOne(['id'=>$id]); - if($order_gift) { - $order_gift->rate = $rate; - $order_gift->price = $price; - $order_gift->save(); - } + if(!$caiwu_info->save()) { + throw new \Exception(print_r($caiwu_info->getErrors(), true)); } - - if($status_id > $old_status_id) { - //处理新保、跟踪、续保提成 - $order_info = $caiwu_info->order; - $car_info = $order_info->car; - //删除相当记录 - PayOrderUserT::deleteAll('order_id='.$order_info->id); - - -// echo $op_user1_id; -// die; -// var_dump($caiwu_info->pay_date); - - //截取日期来进行判断 - $year= (int)substr($caiwu_info->pay_date,0,4); - - if($year>=2018){ - $op11= substr($order_info->op1->getShowName(),0,strpos($order_info->op1->getShowName(),'(')); - $op1_user = UserT::findOne(['username'=>$op11,'is_delete'=>0]); - if($op1_user) { - $pay_order_user = new PayOrderUserT(); - $pay_order_user->user_id = $op1_user->id; - $pay_order_user->order_id = $order_info->id; - $pay_order_user->type = 5; - $pay_order_user->is_own = 0; - $pay_order_user->pay_date = $caiwu_info->pay_date; - $pay_order_user->save(); - $pay_order_user->calPay(); - $pay_info = PayT::findOne(['user_id'=>$pay_order_user->user_id,'pay_date'=>$pay_order_user->pay_date]); - if($pay_info) { - $pay_info->calPay(); - } - } - - $op22= substr($order_info->op2->getShowName(),0,strpos($order_info->op2->getShowName(),'(')); - $op2_user = UserT::findOne(['username'=>$op22,'is_delete'=>0]); - if($op2_user) { - $pay_order_user = new PayOrderUserT(); - $pay_order_user->user_id = $op2_user->id; - $pay_order_user->order_id = $order_info->id; - $pay_order_user->type = 6; - $pay_order_user->is_own = 0; - $pay_order_user->pay_date = $caiwu_info->pay_date; - $pay_order_user->save(); - $pay_order_user->calPay(); - $pay_info = PayT::findOne(['user_id'=>$pay_order_user->user_id,'pay_date'=>$pay_order_user->pay_date]); - if($pay_info) { - $pay_info->calPay(); - } - } - - } - - - - - $op_user1_id = substr($car_info->op_user1,0,strpos($car_info->op_user1,'(')); - $pay1_user = UserT::findOne(['username'=>$op_user1_id,'is_delete'=>0]); - if($pay1_user) { - $pay_order_user = new PayOrderUserT(); - $pay_order_user->user_id = $pay1_user->id; - $pay_order_user->order_id = $order_info->id; - $pay_order_user->type = 1; - $pay_order_user->is_own = $car_info->op_user3 != '' ? 0:1; - $pay_order_user->pay_date = $caiwu_info->pay_date; - $pay_order_user->save(); - $pay_order_user->calPay(); - $pay_info = PayT::findOne(['user_id'=>$pay_order_user->user_id,'pay_date'=>$pay_order_user->pay_date]); - if($pay_info) { - $pay_info->calPay(); - } - } - $op_user2_id = substr($car_info->op_user2,0,strpos($car_info->op_user2,'(')); - $pay2_user = UserT::findOne(['username'=>$op_user2_id,'is_delete'=>0]); - if($pay2_user) { - $pay_order_user = new PayOrderUserT(); - $pay_order_user->user_id = $pay2_user->id; - $pay_order_user->order_id = $order_info->id; - $pay_order_user->type = 2; - $pay_order_user->is_own = 0; - $pay_order_user->pay_date = $caiwu_info->pay_date; - $pay_order_user->save(); - $pay_order_user->calPay(); - $pay_info = PayT::findOne(['user_id'=>$pay_order_user->user_id,'pay_date'=>$pay_order_user->pay_date]); - if($pay_info) { - $pay_info->calPay(); - } - } - $op_user3_id = substr($car_info->op_user3,0,strpos($car_info->op_user3,'(')); - $pay3_user = UserT::findOne(['username'=>$op_user3_id,'is_delete'=>0]); - if($pay3_user) { - $pay_order_user = new PayOrderUserT(); - $pay_order_user->user_id = $pay3_user->id; - $pay_order_user->order_id = $order_info->id; - $pay_order_user->type = 3; - $pay_order_user->is_own = 1; - $pay_order_user->pay_date = $caiwu_info->pay_date; - $pay_order_user->save(); - $pay_order_user->calPay(); - $pay_info = PayT::findOne(['user_id'=>$pay_order_user->user_id,'pay_date'=>$pay_order_user->pay_date]); - if($pay_info) { - $pay_info->calPay(); - } - } - $send_info = $order_info->sendLog; - if($send_info) { - $pay_order_user = new PayOrderUserT(); - $pay_order_user->user_id = $send_info->user_id; - $pay_order_user->order_id = $order_info->id; - $pay_order_user->type = 4; - $pay_order_user->is_own = 0; - $pay_order_user->pay_date = $caiwu_info->pay_date; - $pay_order_user->save(); - $pay_order_user->calPay(); - $pay_info = PayT::findOne(['user_id'=>$send_info->user_id,'pay_date'=>$pay_order_user->pay_date]); - if($pay_info) { - $pay_info->calPay(); - } - } - - - - - - - - - - - - $caiwu_info->lock_id = 0; -// $this->addLog($caiwu_info->order->car_id,'出纳办结完成,提交财务处理',1); - if($year>=2018){ - $this->addLog($caiwu_info->order->car_id,'出纳办结完成,提交财务处理',1); - }else{ - $this->addLog1($caiwu_info->order->car_id,'出纳办结完成,提交财务处理',1); - } - - //处理操作人员状态 - $order_user_info = OrderUserT::findOne(['order_id'=>$caiwu_info->order_id,'user_id'=>$this->my->id,'type_id'=>$old_status_id,'status'=>0]); - if($order_user_info) { - $order_user_info->status = 1; //操作结束 - $order_user_info->save(); - } - } - $caiwu_info->save(); + $tran->commit(); $result['success'] = true; $result['msg'] = '保存成功'; - - $tran->commit(); - } catch(\Throwable $e) { $tran->rollBack(); - file_put_contents('log.txt',$e->getMessage()); - throw $e; + $result['msg'] = $e->getMessage(); } } return $result; @@ -3739,31 +3344,25 @@ class InsurerController extends BaseController $row->return_remark = $return_remark; $row->return_time = time(); $row->lock_id = 0; - $row->save(); + if(!$row->save()) { + throw new \Exception(print_r($row->getErrors(), true)); + } //处理操作人员状态 $order_user_info = OrderUserT::findOne(['order_id'=>$row->id,'user_id'=>$this->my->id,'status'=>0]); if($order_user_info) { $order_user_info->status = 2; //退回 - $order_user_info->save(); + if(!$order_user_info->save()) { + throw new \Exception(print_r($order_user_info->getErrors(), true)); + } $order_user_info2 = new OrderUserT(); $order_user_info2->user_id = $row->user_id; $order_user_info2->order_id = $row->id; $order_user_info2->type_id = 1; $order_user_info2->status = 0; - $order_user_info2->save(); - } - // - //处理礼品数量 - $sel_gifts = OrderGiftT::find() - ->where('order_id='.$order_id) - ->all(); - foreach($sel_gifts as $sel_gift) { - $gift_info = $sel_gift->gift; - if($gift_info && $gift_info->total > -1) { - $gift_info->total = $gift_info->total + 1; - $gift_info->save(); + if(!$order_user_info2->save()) { + throw new \Exception(print_r($order_user_info2->getErrors(), true)); } } @@ -4066,7 +3665,6 @@ class InsurerController extends BaseController public function actionSearch() { return $this->render('search'); } - public function actionSearchJson() { Yii::$app->response->format = Response::FORMAT_JSON; @@ -4081,104 +3679,73 @@ class InsurerController extends BaseController $date2_end = $request->get('date2_end'); $date3_begin = $request->get('date3_begin'); $date3_end = $request->get('date3_end'); - $group_id = $request->get('group_id'); - $company_id = $request->get('company_id'); - $insurance_status= $request->get('insurance_status'); + $status = $request->get('status'); $offset = $request->get('offset',0); $limit = $request->get('limit', 10); - - $group_items = GroupT::getTree(); - $group_ids[] = $group_id; - if($group_id > 0) { - $items = GroupT::getTree($group_id); - foreach($items as $group_info) { - $group_ids[] = $group_info->id; - } - } -// $submit_date='2018-10-14'; -// $near_info= OrderT::find()->where(['car_no'=>$car_no]) -// ->orderBy('created_at desc')->select('car_man,created_at,user_id')->one(); -// $near_info= OrderT::find()->where(['car_no'=>$car_no]) -// ->asArray()->select('created_at,submit_date,id,car_man') -// ->andWhere(['status_id'=>10]) -// ->andWhere(['<', 'submit_date', $submit_date]) -// ->orderBy('created_at desc')->one(); -// -// $car_info->op_user1 = $near_info->user->getShowName(); -// dd($near_info); $query = OrderT::find() ->where('status_id>1') -// ->orderBy('submit_date DESC, id DESC'); ->orderBy('car_no desc,submit_date asc'); if($id_man != '') { - $query = $query->andWhere(['like','id_man',$id_man]); + $query->andWhere(['like','id_man',$id_man]); } if($car_man != '') { - $query = $query->andWhere(['like','car_man',$car_man]); + $query->andWhere(['like','car_man',$car_man]); } if($phone != '') { - $query = $query->andWhere(['like','link_phone',$phone]); + $query->andWhere('car_man_phone like :phone or id_man_phone like :phone or link_man_phone like :phone', [':phone'=>$phone]); } if($car_no != '') { - $query = $query->andWhere(['like','car_no',$car_no]); + $query->andWhere(['like','car_no',$car_no]); } if($date_begin != '') { - $query = $query->andWhere('submit_date>="'.$date_begin.'"'); + $query->andWhere('submit_date>="'.$date_begin.'"'); } if($date_end != '') { - $query = $query->andWhere('submit_date<="'.$date_end.'"'); + $query->andWhere('submit_date<="'.$date_end.'"'); } if($date2_begin != '') { - $query = $query->andWhere('print_date>="'.$date2_begin.'"'); + $query->andWhere('print_date>="'.$date2_begin.'"'); } if($date2_end != '') { - $query = $query->andWhere('print_date<="'.$date2_end.'"'); + $query->andWhere('print_date<="'.$date2_end.'"'); } if($date3_begin != '') { - $query = $query->andWhere('insurer1_begin_date>="'.$date3_begin.'"'); + $query->andWhere('insurer1_begin_date>=:begin_date or insurer2_begin_date>=:begin_date', [':begin_date'=>$date3_begin]); } if($date3_end != '') { - $query = $query->andWhere('insurer1_begin_date<="'.$date3_end.'"'); + $query->andWhere('insurer1_begin_date<=:end_date or insurer2_begin_date<=:end_date', [':end_date'=>$date3_end]); } - - if($company_id != '') { - $query = $query->andWhere('company_id ="'.$company_id.'"'); - } - if($insurance_status != '') { - $query = $query->andWhere('insurance_status ="'.$insurance_status.'"'); + if($status > 0) { + if($status == 1) { + $query->andWhere('status>1 and status<10'); + } + if($status == 2) { + $query->andWhere('status=10'); + } } - $total = $query->count(); - $query = $query->offset($offset)->limit($limit); - $items = $query->all(); - -// echo $query->createCommand()->rawSql; - $sum = $query->sum('total1_clear'); - $sum1 = $query->sum('total2_clear'); -// var_dump($sum1) ; - $company_items = InsurerCompanyT::find()->all(); + $query->offset($offset)->limit($limit); + $items = $query->all(); $data = []; $data['total'] = $total; $data['rows'] = []; - $data['sum'] = $sum; - $data['sum1'] = $sum1; - $data['company_info'] = $company_items; foreach($items as $item) { $row = $item->toArray(); - $row['car_factory_model'] = $item->car?MyLib::substr_cut($item->car->factory_model,15):''; - $row['show_name'] = $item->user?$item->user->getShowName():''; - $row['status_txt'] = $item->status?$item->status->name:''; - $row['company_name'] = $item->company&&$item->company->name?$item->company->name:''; - $row['upload_status_txt'] = $item->shangye_src || $item->jiaoqiang_src?'保单已上传': '未上传'; - $row['lock_show_name'] = $item->lock?$item->lock->getShowName():''; + $row['lock_name'] = $item->lock?$item->lock->getShowName():''; + $row['status'] = $item->status->name; + $row['username'] = $item->user->getShowName(); + $row['company_name'] = $item->company->name; + $row['file_status'] = '未上传'; + if($item->shangye_src || $item->jiaoqiang_src) { + $row['file_status'] = '保单已上传'; + } $data['rows'][] = $row; } return $data; } - public function actionSearch1() { $request = Yii::$app->request; @@ -4285,6 +3852,10 @@ class InsurerController extends BaseController $order_weizhi_info->num=1; $order_weizhi_info->save(); } + + + + } $sum = $query->sum('total1_clear'); @@ -4346,6 +3917,9 @@ class InsurerController extends BaseController } $tran->commit(); + + $result['success'] = true; + $result['msg'] = '放弃成功'; } catch (\Exception $e) { $tran->rollBack(); throw $e; @@ -5081,6 +4655,37 @@ class InsurerController extends BaseController } return $result; } + public function actionGiftUnSave() + { + Yii::$app->response->format = Response::FORMAT_JSON; + + $request = Yii::$app->request; + $result = array(); + $result['success'] = false; + $result['msg'] = '取消失败'; + + if ($request->isPost) { + $id = $request->post('order_id', 0); + + $order_info = OrderT::findOne($id); + + $tran = OrderT::getDb()->beginTransaction(); + try { + $order_info->gift_status = 0; + if(!$order_info->save()) { + throw new \Exception(print_r($order_info->getErrors(), true)); + } + $result['success'] = true; + $result['msg'] = '取消成功'; + + $tran->commit(); + } catch (\Exception $e) { + $tran->rollBack(); + $result['msg'] = $e->getMessage(); + } + } + return $result; + } public function actionGiftSave() { Yii::$app->response->format = Response::FORMAT_JSON; @@ -5105,7 +4710,7 @@ class InsurerController extends BaseController $result['msg'] = '正本还没有生成,不能确认礼品'; return $result; } - + $gift_counts = []; $tran = OrderT::getDb()->beginTransaction(); try { // OrderGiftT::deleteAll('order_id=' . $order_info->id . ' and gift_src is null'); @@ -5116,6 +4721,7 @@ class InsurerController extends BaseController $zhongjigift_item = ZhongjiGiftT::findOne(['id'=>$tmp[0]]); $gift_id = $tmp[1]; $gift_item = GiftT::findOne(['id'=>$gift_id]); + $order_gift_id = 0; if($zhongjigift_item && $gift_item) { $row = new OrderGiftT(); $row->order_id = $order_info->id; @@ -5130,6 +4736,20 @@ class InsurerController extends BaseController if (!$row->save()) { throw new \Exception(print_r($row->getErrors(), true)); } + $order_gift_id = $row->id; + if(!isset($gift_counts[$zhongjigift_item->id])) { + $gift_counts[$zhongjigift_item->id] = 1; + } else { + $gift_counts[$zhongjigift_item->id] += 1; + } + if($gift_counts[$zhongjigift_item->id] > $zhongjigift_item->n) { + $result['msg'] = '礼品数量超限,请重新选择'; + return $result; + } + } + //生成礼品图片 + if($gift_item) { + $this->getGift(0, $gift_id, $order_info->car_no, $order_info, $order_gift_id); } } //礼券 @@ -5138,6 +4758,7 @@ class InsurerController extends BaseController $zhongjigift_item = ZhongjiGiftT::findOne(['id'=>$tmp[0]]); $gift_id = $tmp[1]; $gift_item = GiftT::findOne(['id'=>$gift_id]); + $order_gift_id = 0; if($zhongjigift_item && $gift_item) { $row = new OrderGiftT(); $row->order_id = $order_info->id; @@ -5152,6 +4773,20 @@ class InsurerController extends BaseController if (!$row->save()) { throw new \Exception(print_r($row->getErrors(), true)); } + $order_gift_id = $row->id; + if(!isset($gift_counts[$zhongjigift_item->id])) { + $gift_counts[$zhongjigift_item->id] = 1; + } else { + $gift_counts[$zhongjigift_item->id] += 1; + } + if($gift_counts[$zhongjigift_item->id] > $zhongjigift_item->n) { + $result['msg'] = '礼券数量超限,请重新选择'; + return $result; + } + } + //生成礼券图片 + if($gift_item) { + $this->getGift(0, $gift_id, $order_info->car_no, $order_info, $order_gift_id); } } $order_info->gift_status = 1; @@ -5169,5 +4804,143 @@ class InsurerController extends BaseController } return $result; } + public function getGift($k, $v, $car_no, $order_info, $order_gift_id) + { + $result = array(); + $result['tishi'] = true; + $result['teshu'] = false; + $gift_info = GiftT::findOne(['id' => $v]); + if($order_gift_id == 0) { + return; + } + $bianhao = ''; + $endDate = ''; + //礼券 + if ($gift_info && $gift_info->type_id == 2) { + $pinyin_arr = explode(' ', $gift_info->pinyin_name); +// dd($pinyin_arr); + $liquan_str = 'ch'; + //获取礼券拼音首字母 + foreach ($pinyin_arr as $first) { + $liquan_str .= substr($first, 0, 1); + } + $liquan_str = strtolower($liquan_str); + //获取提单日期 + $liquan_str .= date('Ymd', strtotime($order_info->print_date)); + + //获取该礼券下的最后一条记录 + $gift_use = GiftTicketTUse::find()->where(['type_id' => $v, 'status' => 1])->orderBy('created_at desc')->one(); + + //礼券的使用 + $new_gift_use = new GiftTicketTUse(); + if ($gift_use) { + $liquan_str .= sprintf("%04d", $gift_use->gift_shuzi + 1); + $new_gift_use->gift_shuzi = $gift_use->gift_shuzi + 1; + $new_gift_use->code = $liquan_str; + + } else { + $liquan_str .= sprintf("%04d", 1); + $new_gift_use->gift_shuzi = 1; + $new_gift_use->code = strtoupper($liquan_str); + } + $new_gift_use->op_id = $this->my->id; + $new_gift_use->type_id = $v; //礼券ID + $new_gift_use->input_date = date('Y-m-d H:i:s'); + $new_gift_use->car_no = $car_no; + $new_gift_use->order_id = $order_info->id; + $new_gift_use->status = 1; + $new_gift_use->end_date = $order_info->insurer1_end_date; + + if(!$new_gift_use->save()) { + throw new \Exception(print_r($new_gift_use->getErrors(), true)); + } + + //表头 + $bianhao = strtoupper($liquan_str); //转换成大写编号 + $endDate = '有效期' . $order_info->insurer1_end_date; + } + //礼品的使用 + if ($gift_info && $gift_info->type_id == 1) { + $shiwu_use = GiftTicketTUse::find()->where(['type_id' => $v, 'status' => 1])->orderBy('created_at desc')->one(); + + $new_shiwu = new GiftTicketTUse(); + + if ($shiwu_use) { + $new_shiwu->gift_shuzi = $shiwu_use->gift_shuzi + 1; + $new_shiwu->code = sprintf("%04d", $gift_use->gift_shuzi + 1); + } else { + $new_shiwu->gift_shuzi = 1; + $new_shiwu->code = sprintf("%04d", 1); + } + $new_shiwu->op_id = $this->my->id; + $new_shiwu->type_id = $v; + $new_shiwu->input_date = date('Y-m-d H:i:s'); + $new_shiwu->car_no = $car_no; + $new_shiwu->status = 1; + $new_shiwu->order_id = $order_info->id; + $new_shiwu->end_date = $order_info->insurer1_end_date; + if(!$new_shiwu->save()) { + throw new \Exception(print_r($new_shiwu->getErrors(), true)); + } + //表头 + $bianhao = ''; + $endDate = ''; + } + + $gift_name = $gift_info->name; + + //生成png文件 + $gift_src = ''; + $panduan = (object)array(); + $datetime = date('YmdHis'); + $name = md5(rand(100, 200)); + $imgstr = '@frontend/web/upload/images/'.date('Ym'); + $imgstr .= '/gift' . $name . '' . $datetime . '.png'; + FileHelper::createDirectory(dirname(str_replace('@frontend/web/', '',$imgstr))); + + //生成新的图片 + if ($gift_info && $gift_info->type_id == 1) { // 实物 + \yii\imagine\Image::thumbnail('@frontend/web/images/gift.png', 400, 252) + ->save(Yii::getAlias($imgstr), + ['quality' => 100]);//生成缩略图的质量 + //图片打水印 + \yii\imagine\Image::text('@frontend/web/images/gift.png', $bianhao, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [15, 15], ['color' => '000000', 'size' => 12]) + ->save(Yii::getAlias($imgstr)); + \yii\imagine\Image::text($imgstr, $gift_name, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [20, 50], ['color' => '000000', 'size' => 20]) + ->save(Yii::getAlias($imgstr)); + + \yii\imagine\Image::text($imgstr, $car_no, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [20, 120], ['color' => '000000', 'size' => 20]) + ->save(Yii::getAlias($imgstr)); + + $panduan = \yii\imagine\Image::text($imgstr, $endDate, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [20, 200], ['color' => '000000', 'size' => 20]) + ->save(Yii::getAlias($imgstr)); + + } elseif ($gift_info && $gift_info->type_id == 2) { + $liquanSrc = '@frontend/web' . $gift_info->original_img; + \yii\imagine\Image::thumbnail($liquanSrc, 1097, 979) + ->save(Yii::getAlias($imgstr), + ['quality' => 100]);//生成缩略图的质量 + //图片打水印 + $bianhao = '券号:' . $bianhao; + \yii\imagine\Image::text($liquanSrc, $bianhao, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [325, 85], ['color' => 'ffffff', 'size' => 14]) + ->save(Yii::getAlias($imgstr)); + + \yii\imagine\Image::text($imgstr, $car_no, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [900, 400], ['color' => 'ffffff', 'size' => 16]) + ->save(Yii::getAlias($imgstr)); + + $panduan = \yii\imagine\Image::text($imgstr, $endDate, Yii::getAlias('@frontend/web/fonts/msyh.ttc'), [850, 440], ['color' => 'ffffff', 'size' => 16]) + ->save(Yii::getAlias($imgstr)); + } + + + $gift_src = str_replace('@frontend/web', '', $imgstr); + //保存order_gift_t表里png文件地址 + + $order_gift_info = OrderGiftT::findOne(['id' => $order_gift_id]); + $order_gift_info->gift_src = $gift_src; + if(!$order_gift_info->save()) { + throw new \Exception(print_r($order_gift_info->getErrors(), true)); + } + } } diff --git a/frontend/controllers/MarketingStrategyController.php b/frontend/controllers/MarketingStrategyController.php index 91f954b..0435442 100644 --- a/frontend/controllers/MarketingStrategyController.php +++ b/frontend/controllers/MarketingStrategyController.php @@ -467,16 +467,26 @@ class MarketingStrategyController extends UserBaseController $car_use_id = $request->post('car_use_id', 0); $company2_id = $request->post('company2_id', 0); + //获取自己的所有策略 + $items = ZhongjiUserT::find() + ->where(['user_id'=>$this->my->id]) + ->all(); + $celuo_ids = []; + foreach($items as $item) { + $celuo_ids[] = $item->celuo_id; + } $date = date('Y-m-d H:i:s'); - $yingxiao_item = ZhongjiYingxiao::find() + $query = ZhongjiYingxiao::find() ->where('begin_date<=:begin_date and end_date>=:end_date',[':begin_date'=>$date,':end_date'=>$date]) - ->orderBy('id desc') - ->one(); + ->andWhere(['in','id',$celuo_ids]) + ->orderBy('id desc'); + $yingxiao_item = $query->one(); if(!$yingxiao_item) { return $result; } $items = ZhongjiTiaojian::find() ->where('celuo_id=:celuo_id and type=1',[':celuo_id'=>$yingxiao_item->id]) + ->andWhere(['<','baofei', $total1_clear]) ->all(); $ids = []; foreach($items as $item) { diff --git a/frontend/controllers/PhoneCenterController.php b/frontend/controllers/PhoneCenterController.php index 4cd53b8..3e6651f 100644 --- a/frontend/controllers/PhoneCenterController.php +++ b/frontend/controllers/PhoneCenterController.php @@ -48,7 +48,12 @@ class PhoneCenterController extends BaseController public $layout = 'blue-main'; public function actionCallRecords() { - return $this->render('call-records'); + $request = Yii::$app->request; + $company_type = $request->get('company_type',0); + + return $this->render('call-records', [ + 'company_type' => $company_type + ]); } public function actionCallRecordsJson(){ Yii::$app->response->format = Response::FORMAT_JSON; @@ -67,14 +72,6 @@ class PhoneCenterController extends BaseController $company_type = $request->get('company_type',0);//0显示全部,1只显示江西,2只显示湖北 - if($company_type == 1){ - $company_id=2; - }elseif ($company_type == 2){ - $company_id=3; - }else { - $company_id=0; - } - $query = NetworkPhoneT::find() ->leftJoin('user_t','user_t.id=network_phone_t.user_id') ->where('user_t.is_delete=0 and user_t.is_leave=0'); @@ -111,10 +108,7 @@ class PhoneCenterController extends BaseController if($username != ''){ $query->andWhere('user_t.username="'.$username.'"'); } - if($company_id > 0) { - $query->andWhere('user_t.company_id='.$company_id); - } - +// echo $query->createCommand()->rawSql; $total = $query->count(); $query->offset($offset)->limit($limit); @@ -512,7 +506,11 @@ public function actionDownload(){ } public function actionUsercallIndex() { - return $this->render('usercall-index'); + $request = Yii::$app->request; + $company_type = $request->get('company_type',0); + return $this->render('usercall-index',[ + 'company_type' => $company_type + ]); } public function actionUsercallIndexJson(){ Yii::$app->response->format = Response::FORMAT_JSON; @@ -530,12 +528,6 @@ public function actionDownload(){ $user_id = 0; - if($company_type == 1){ - $company_id=2; - }elseif ($company_type == 2){ - $company_id=3; - } - $query = UserT::find() ->rightJoin('network_phone_assign_t','`network_phone_assign_t`.`user_id`=`user_t`.`id`'); @@ -547,9 +539,6 @@ public function actionDownload(){ if($caller != ''){ $query->andWhere('user_t.username="'.$caller.'"'); } - if($company_id > 0) { - $query->andWhere('user_t.company_id='.$company_id); - } $query->andWhere('user_t.is_delete=0 and user_t.is_leave=0')->orderBy('user_t.username'); @@ -563,16 +552,6 @@ public function actionDownload(){ $total = $query->count(); - - -// foreach($items as $value){ -// $car_data= CarT::findOne(['id'=>$value->car_id]); -// $value->car_no=$car_data->car_no; -// $value->save(); -// } -// dd($items); -// die; - $query = $query->offset($offset)->limit($limit); $items = $query->all(); @@ -582,6 +561,24 @@ public function actionDownload(){ $data['rows'] = []; foreach($items as $item) { $row = $item->toArray(); + $row['total_call_num'] = $item->totalCallNum($begin_date,$end_date); + $row['total_call_time_out'] = $item->totalCallTimeOut($begin_date,$end_date); + $row['total_call_time'] = $item->totalCallTime($begin_date,$end_date); + $row['call_in_total_num'] = $item->callInTotalNum($begin_date,$end_date); + $row['call_in_suc_num'] = $item->callInSucNum($begin_date,$end_date); + $row['call_in_suc_num_rate'] = number_format($item->callInTotalNum($begin_date,$end_date)? $item->callInSucNum($begin_date,$end_date)/$item->callInTotalNum($begin_date,$end_date) :0,2); + $row['call_out_total_num'] = $item->callOutTotalNum($begin_date,$end_date); + $row['call_out_suc_num'] = $item->callOutSucNum($begin_date,$end_date); + $row['call_out_suc_num_rate'] = number_format($item->callOutTotalNum($begin_date,$end_date)?$item->callOutSucNum($begin_date,$end_date)/$item->callOutTotalNum($begin_date,$end_date):0,2) ; + if($item->phoneStatus) { + if($item->phoneStatus->is_phone==1) { + $row['phone_status'] = '
通话中
'; + } else { + $row['phone_status'] = '
未通话
'; + } + } else { + $row['phone_status'] = '
未通话
'; + } $data['rows'][] = $row; } diff --git a/frontend/controllers/PhoneController.php b/frontend/controllers/PhoneController.php index 021d443..22e8e0e 100644 --- a/frontend/controllers/PhoneController.php +++ b/frontend/controllers/PhoneController.php @@ -248,7 +248,8 @@ class PhoneController extends \yii\web\Controller } } -public function actionPushApi() + + public function actionPushApi() { // header("Content-type: text/html; charset=utf-8"); // Yii::$app->response->format = Response::FORMAT_JSON; @@ -275,8 +276,14 @@ public function actionPushApi() $called_area=$request->post('called_area'); $extend=$request->post('extend'); + $item = NetworkPhoneAssignT::find() + ->where('phone=:phone1 or phone=:phone2',[':phone1'=>$caller,':phone2'=>$called]) + ->one(); + if(!$item) { + return json_encode(['code' => 400,'message' => "失败"]);; + } +// file_put_contents('/tmp/'.time().rand(100,999).'.log', print_r($request->post(), true)); //$b = new GiftCreateImageErrorT(); - $network_phone = NetworkPhoneT::findOne(['recorder_id'=>$recorder_id]); if(!$network_phone){ @@ -330,13 +337,6 @@ public function actionPushApi() $network_phone->extend=$extend; $network_phone->begin_date=date('Y-m-d'); - - - - - - - $network_phone->is_called=$is_called; $res = $network_phone->save(false); @@ -346,14 +346,12 @@ public function actionPushApi() $begin_time = date('Y-m-d H:i:s',time()-10*24*3600); $end_time = date('Y-m-d H:i:s',time()-900); - $phone_items = NetworkPhoneT::find()->where('release_time>="'.$begin_time.'"') - ->andWhere('release_time<="'.$end_time.'"') - ->andWhere('call_result="ANSWERED"') - ->andWhere('record_file_url is null or record_file_url = ""') - ->andWhere('record_file_url_real is not null or record_file_url_real <> ""') - ->all(); -// $b->error = 222; -// $b->save(); + $phone_items = NetworkPhoneT::find()->where('release_time>="'.$begin_time.'"') + ->andWhere('release_time<="'.$end_time.'"') + ->andWhere('call_result="ANSWERED"') + ->andWhere('record_file_url is null or record_file_url = ""') + ->andWhere('record_file_url_real is not null or record_file_url_real <> ""') + ->all(); foreach ($phone_items as $item) { if ($item->record_file_url == '') { $url = ''; @@ -373,14 +371,34 @@ public function actionPushApi() } } -// $b->error = 333; -// $b->save(); -// if($res){ return json_encode(['code' => 0,'message' => "成功"]); -// }else{ -// return ['code' => 400,'message' => "失败",]; -// } + $phone_items = NetworkPhoneT::find()->where('release_time>="'.$begin_time.'"') + ->andWhere('release_time<="'.$end_time.'"') + ->andWhere('call_result="ANSWERED"') + ->andWhere('record_file_url is null or record_file_url = ""') + ->andWhere('record_file_url_real is not null or record_file_url_real <> ""') + ->all(); + foreach ($phone_items as $item) { + if ($item->record_file_url == '') { + $url = ''; + + if ($item->record_file_url_real != '') { + + $url = $this->phoneMp3($item->record_file_url_real); + + } + + if ($url != '') { + $item->record_file_url = $url; + $item->save(false); + } + + + } + } + + return json_encode(['code' => 0,'message' => "成功"]); } function phoneMp3Bak($url) { @@ -474,7 +492,6 @@ public function actionPushApi() } - public function actionCallApi() { header("Content-type: application/json;charset=UTF-8"); diff --git a/frontend/views/car/edit.php b/frontend/views/car/edit.php index 578d4c2..d198499 100644 --- a/frontend/views/car/edit.php +++ b/frontend/views/car/edit.php @@ -31,9 +31,12 @@ use \common\libs\MyLib;
- +
- +
@@ -41,6 +44,10 @@ use \common\libs\MyLib;
+ +
+ +
@@ -49,27 +56,13 @@ use \common\libs\MyLib;
- -
- -
- +
- +
- +
+ +
+ +
diff --git a/frontend/views/car/info.php b/frontend/views/car/info.php index e44cfc8..e9a162a 100644 --- a/frontend/views/car/info.php +++ b/frontend/views/car/info.php @@ -22,7 +22,7 @@ use \common\libs\MyLib; 操作记录 - + 返回
@@ -168,6 +168,9 @@ use \common\libs\MyLib;
预约记录
+ + 无效数据 + 预约 @@ -207,6 +210,10 @@ use \common\libs\MyLib; title = '投保'; layer_show(title, '/car/order-add?car_id=id?>'); } + function invalidDlg() { + title = '无效数据'; + layer_show(title, '/car/invalid-car?car_id=id?>'); + } function appointmentDlg() { title = '添加预约'; layer_show(title, '/appointment/add?car_id=id?>'); @@ -363,7 +370,7 @@ use \common\libs\MyLib; var number_one = phone; - $.get('/phone/ax-out',{'phone':number_one,'user_id':'id?>'},function(obj){ + $.get('/phone/ax-out',{'phone':number_one,'user_id':''},function(obj){ if(obj.success) { @@ -512,7 +519,5 @@ use \common\libs\MyLib; ws.send(val); console.log("数据已发送"); } - - endBlock(); ?> \ No newline at end of file diff --git a/frontend/views/car/invalid-car.php b/frontend/views/car/invalid-car.php new file mode 100644 index 0000000..c8fb339 --- /dev/null +++ b/frontend/views/car/invalid-car.php @@ -0,0 +1,67 @@ + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +beginBlock('footer_js'); ?> + +endBlock('footer_js'); ?> diff --git a/frontend/views/car/order-add.php b/frontend/views/car/order-add.php index 60579ac..43e2c26 100644 --- a/frontend/views/car/order-add.php +++ b/frontend/views/car/order-add.php @@ -11,8 +11,8 @@ use common\models\PriceT;
- - + +
保单信息
@@ -23,12 +23,22 @@ use common\models\PriceT; 车牌号 初登日期 - + 座位数 电子邮件 + + 车架号 + + 发动机号 + + 厂牌型号 + + 新车购置价 + + 车主 @@ -77,20 +87,20 @@ use common\models\PriceT; 商业起保日期 - + 交强起保日期 - + 保险公司 - id.'"'; - if($item->id == $order_info->company2_id) + if($item->id == $order_info->company_id) echo ' selected '; echo '>'.$item->name.''; } @@ -140,7 +150,7 @@ use common\models\PriceT; content != '') { $tmp_items = explode(',',$item->content); - echo ''; $tmp_items = explode(',',$item->content); foreach($tmp_items as $tmp_item) { echo ''; } else { - echo ''; @@ -158,10 +168,12 @@ use common\models\PriceT; ?> + has_nopay == 1) { ?>
is_nopay == 1)?'checked':''?>>
+ 应收 -   -   + 支付方式 + + + 备注 @@ -313,27 +337,19 @@ use common\models\PriceT; beginBlock('footer_js'); ?> endBlock(); ?> diff --git a/frontend/views/finance/car-update-frame.php b/frontend/views/finance/car-update-frame.php index 24a712c..f8cfdfb 100644 --- a/frontend/views/finance/car-update-frame.php +++ b/frontend/views/finance/car-update-frame.php @@ -62,16 +62,6 @@ use \common\libs\MyLib; }); }); $(function () { - //上传 - $('#fileupload').fileupload({ - url: '/finance/receipt-upload', - dataType: 'json', - done: function (e, data) { - var file_info = data.result.files[0]; - $('#urlfile').val(file_info.url); - $('#submit-btn').removeAttr('disabled'); - } - }); //提交按钮 $(".btn-save").click(function(){ parent.layer.confirm('是否确认提交?', { @@ -80,7 +70,7 @@ use \common\libs\MyLib; }, function(){ var params = $("#theFrm").serialize(); $.post('/finance/car-update-frame-info',params,function(obj){ - parent.layer.msg(data.msg); + parent.layer.msg(obj.msg); if(obj.success) { window.location.reload(); } diff --git a/frontend/views/finance/receipt-info.php b/frontend/views/finance/receipt-info.php index 62a7751..79ef837 100644 --- a/frontend/views/finance/receipt-info.php +++ b/frontend/views/finance/receipt-info.php @@ -1,79 +1,105 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
车牌号 - car_no?> -
保险公司 - company?> - 保单号 - -
总保费 - total?> - 净保费 - total_clear?> -
手续费比例 - % -
回款金额 - - 回款日期 - -
- -    - -
- - - - + +beginBlock('header_css'); ?> + +endBlock(); ?> + +
+
+
+
+
+
+ +
+ +
+

car_no?>

+
+
+
+ +
+

order->company2->name?>

+
+ +
+ +
+
+
+ +
+

total?>

+
+ +
+

total_clear?>

+
+
+
+ +
+
+ +
%
+
+
+
+
+ +
+ +
+ +
+ +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +beginBlock('footer_js'); ?> + +endBlock('footer_js'); ?> + diff --git a/frontend/views/finance/receipt.php b/frontend/views/finance/receipt.php index ef5c8b4..c12a509 100644 --- a/frontend/views/finance/receipt.php +++ b/frontend/views/finance/receipt.php @@ -19,7 +19,7 @@ use \common\libs\MyLib;
-
+
- - - - - - - - 批对日期 - - - - - - - - - -    - - - - - - - - - - - -
- - - - 保单号: - 车牌: - - 出单日期: - - -- - - 回单日期: - - -- - - 保险公司: - 排序: - - - - -
- - - - - - - - - - - - - - - - - - - - $item) { - $start_index = ($page-1)*20+$index; - $order = $item->order; - $caiwu = $order->caiwu; -// $caiwu = $order->caiwu; -// $rate = $caiwu ? $caiwu->budian_rate : 0; - if($item->insurer_type==2){ - $caiwu->budian_rate=0; - } - $total_clear = round($item->total_clear * $caiwu->budian_rate/100,2); - $b_total = $item->b1_total+$item->b2_total+$item->b3_total; -// $total_clear_real = $item->total_clear * $rate/100; -// $total_dis = round($total_clear_real - $item->r_total,2); - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
序号车牌号保险公司保单号出单日期商业净保费补点比例应得金额补点1回款补点1日期补点2回款补点2日期补点3回款补点3日期已回金额未回金额
car_no?>company ? $order->company->name:''?>insurer_no?>print_date?>total_clear?>budian_rate?>b1_total?>b1_date?>b2_total?>b2_date?>b3_total?>b3_date?>
- - - - - - - - + + + +endBlock(); ?> diff --git a/frontend/views/gift-group/edit.php b/frontend/views/gift-group/edit.php deleted file mode 100644 index bc36b38..0000000 --- a/frontend/views/gift-group/edit.php +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
分组名称
针对岗位 - - 注:如果针对全部岗位,则保持空。多个岗位之间用逗号间隔。 -
是否免费 - -
是否需要车损险 - -
最低额度
最高额度
包含礼品 - id,$gift_ids)) - echo ' checked '; - echo '>'.$item->name.''; - } - ?> -
- -    - -
- - - - diff --git a/frontend/views/gift-group/index.php b/frontend/views/gift-group/index.php deleted file mode 100644 index e991eca..0000000 --- a/frontend/views/gift-group/index.php +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - -
- 名称: - - -
- - - - - - - - - - - - $item) { - ?> - - - - - - - - - - - -
ID分类名称是否免费是否车损险最低额度最高额度包含礼品操作
id?>name?>is_free==1?'是':''?>is_damage==1?'是':''?>min_money==0?'无限制':$item->min_money.'元'?>max_money==0?'无限制':$item->max_money.'元'?>gifts) foreach($item->gifts as $gift) { - echo $gift->name.', '; - } - ?> - [修改] - [删除] -
diff --git a/frontend/views/gift-type/edit.php b/frontend/views/gift-type/edit.php deleted file mode 100644 index 1e7cfe5..0000000 --- a/frontend/views/gift-type/edit.php +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - -
名称 - -
- -    - -
- - - - diff --git a/frontend/views/gift-type/index.php b/frontend/views/gift-type/index.php deleted file mode 100644 index 65aaada..0000000 --- a/frontend/views/gift-type/index.php +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - -
- 名称: - - -
- - - - - - - $item) { - ?> - - - - - - -
排序名称操作
name?> - [修改] - [删除] -
diff --git a/frontend/views/gift-type/type2-edit.php b/frontend/views/gift-type/type2-edit.php deleted file mode 100644 index 761623d..0000000 --- a/frontend/views/gift-type/type2-edit.php +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - -
名称 - -
- -    - -
- - - - diff --git a/frontend/views/gift-type/type2-list.php b/frontend/views/gift-type/type2-list.php deleted file mode 100644 index 1b7a9c5..0000000 --- a/frontend/views/gift-type/type2-list.php +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - -
- 名称: - - -
- - - - - - - $item) { - ?> - - - - - - -
排序名称操作
name?> - [修改] - [删除] -
diff --git a/frontend/views/gift-type/type3-edit.php b/frontend/views/gift-type/type3-edit.php deleted file mode 100644 index 562bdca..0000000 --- a/frontend/views/gift-type/type3-edit.php +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - -
名称 - -
价格 - 小于零时,为百分比。 -
数量 - -1为无限数量。 -
类型 - - -
- -    - -
- - - - diff --git a/frontend/views/gift-type/type3-list.php b/frontend/views/gift-type/type3-list.php deleted file mode 100644 index b3d4676..0000000 --- a/frontend/views/gift-type/type3-list.php +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - -
- 名称: - - -
- - - - - - - - - - $item) { - ?> - - - - - - - - - -
排序名称价格数量类型操作
name?>price?>price<0?'%':'元'?>total<0?'无限':$item->total?>type==0?'实物':'礼券'?> - [修改] - [删除] -
diff --git a/frontend/views/gift/gift-use.php b/frontend/views/gift/gift-use.php index 4a64481..549889e 100644 --- a/frontend/views/gift/gift-use.php +++ b/frontend/views/gift/gift-use.php @@ -8,7 +8,7 @@ use \common\libs\MyLib;
-
-
- -
- -
- -
- -
- -
- -
- -
- -
+ +
+ +
-
- -
- -
- -
- -
- -
- -
- -
- -
+
+ +
-
- -
-
- - - -
-
- -
-
- - - -
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + +
-
- +
+
+ +
+ + +
+
@@ -93,16 +86,14 @@ use \common\libs\MyLib; ID - 礼券编号 + 礼品编号 礼品 车牌号 车架号 - 发放日期 - 有效期日期 - 提单人 - 使用日期 - 状态 - 操作员 + 提单人 + 出库日期 + 状态 + 操作员 操作 @@ -131,6 +122,10 @@ use \common\libs\MyLib; return opStr.join(' '); } + function edit(id) { + title = '礼品核销'; + layer_show(title, '/gift/gift-use-edit?id='+id); + } function refreshList() { $('#listTable').bootstrapTable('refresh'); } diff --git a/frontend/views/gift/index.php b/frontend/views/gift/index.php index d941933..f9ac198 100644 --- a/frontend/views/gift/index.php +++ b/frontend/views/gift/index.php @@ -22,8 +22,8 @@ use \common\libs\MyLib;
- + diff --git a/frontend/views/insurer/finance-mng-edit.php b/frontend/views/insurer/finance-mng-edit.php index 951bb23..18a7189 100644 --- a/frontend/views/insurer/finance-mng-edit.php +++ b/frontend/views/insurer/finance-mng-edit.php @@ -1,571 +1,382 @@ - - - - - - - - -
- - - - - -
- - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
车牌号car_no?>厂牌型号factory_model?>品牌brand?$car_info->brand->name:''?>车系series?$car_info->series->name:''?>
发动机号engine_no?>车架号car_frame_no?>初登日期register_date?>排量displacement?$car_info->displacement->name:''?>
车辆类型carType?$car_info->carType->name:''?>运营性质carUse?$car_info->carUse->name:''?>座位数seats?>年份car_year?>
车主car_man?>联系电话phone?>证件号码car_man_number?>
备注remark?>业务员user?$order_info->user->getShowName():''?>联系电话user?$order_info->user->phone:''?>
-
- - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
被保险人id_man?>证件号码id_number?>联系人link_man?>联系电话link_phone?>
保险公司company?$order_info->company->name:''?>付款方式shoufei_id?MyLib::zhifufs($order_info->shoufei_id).'-':''?>payType?$order_info->payType->name:''?>电子邮件email?>
商业起保日期insurer1_begin_date?>交强起保日期insurer2_begin_date?>缴费单号pay_no?>
商业保单号insurer1_no?>交强保单号insurer2_no?>备注remark?>
送单地址 - send_address?> -
-
- - - - - - -
- - - - -
- - '; - $neirong = ''; - $bujimianpei = ''; - foreach ($new_array as $k=>$v){ - $xianzhong .= ""; - $neirong .= ""; - $bujimianpei .= ""; - } - echo $xianzhong.''.$neirong.''.$bujimianpei.''; - ?> -
险种
内容
不计免赔".$v['zl']."".$v['neir']."".$v['bjmp']."
-
- - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
商业总净保费total1_clear?>商业含税总保费total1?>交强总净保费total2_clear?>交强含税总保费total2?>
车船税total3?>共计签单total_all?>折扣后商业净保费total1_real?>减免金额total1_dis?>
商业折扣率total1_percent?>应收total_real?>商业手续费total1_rate?>交强手续费total2_rate?>
备注price_remark?>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
商业补点比例%商业补点手续费
商业退保保费退保手续费比例%商业退保手续费商业退保日期
交强退保保费退保手续费比例%交强退保手续费交强退保日期
-
- - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
*领款人*银行账号*开户行
转账日期转账金额转账银行 - -
银行流水号转账状态 - -
- - - - op_user3 != '') { - ?> - - - - - op1_id > 0) { - echo ''; - } - if($order_info->op2_id > 0) { - echo ''; - } - ?> - - - - op_user3 != '') { - ?> - - - - - op1_id > 0) { ?> - - - op2_id > 0) { ?> - - - - - op_user3 != '') { - ?> - - - - - - - - op1_id > 0) { ?> - - - op2_id > 0) { ?> - - - - - - op_user3 != '') { - ?> - - - - - op1_id > 0) { ?> - - - op2_id > 0) { ?> - - - - - op_user3 != '') { - ?> - - - - - - - - op1_id > 0) { ?> - - - op2_id > 0) { ?> - - - -
新保:op_user1?>跟踪:op_user2?>续保:op_user3?>送单费:sendLog?$order_info->sendLog->user->getShowName():''?>核保:'.$order_info->op1->getShowName().'正本:'.$order_info->op2->getShowName().'
新保比例跟踪比例续保比例送单比例核保比例正本比例
%%%%%%%
新保提成跟踪提成续保提成送单提成核保提成正本提成
- - - - - - gift->type == 1) continue; - if($index > 0 && $index%3 == 0) { - echo ''; - } - ?> - - - 0) { - while($index%3!=0) { - echo ''; - echo ''; - $index++; - } - } - ?> - -
实物
gift->name?> - - - 元 -
- - - - - - gift->type == 0) continue; - if($index > 0 && $index%3 == 0) { - echo ''; - } - $index++; - ?> - - - - 0) { - while($index%3!=0) { - echo ''; - echo ''; - echo ''; - $index++; - } - } - ?> - -
礼券
gift->name?> - - % - - 元 -
-
- - - - - - - -
- - - - -
-
-
-
- -
- -    - -    - -    - -
+beginBlock('header_css'); ?> + +endBlock(); ?> - - - - - - + + + \ No newline at end of file + +endBlock(); ?> diff --git a/frontend/views/insurer/finance-mng.php b/frontend/views/insurer/finance-mng.php index 0bf87de..851d9e8 100644 --- a/frontend/views/insurer/finance-mng.php +++ b/frontend/views/insurer/finance-mng.php @@ -34,22 +34,23 @@ use \common\libs\MyLib; - + - + - - - - + + + + + + + - - - - + +
IDID 被保险人联系电话联系电话 保险公司 车牌号 正本日期商业保单号交强保单号共计签单级别级别 销售座席商业净保费公司返金额业务自付实返现金额转账时间转账状态 状态转账状态支付方式当前操作操作当前操作操作
@@ -68,14 +69,33 @@ use \common\libs\MyLib; var o = {}; function opFormatter(value, row, index) { var opStr = []; - opStr.push(''); + if(row.lock_man != '') { + opStr.push(''); + opStr.push(''); + opStr.push(''); + } + opStr.push('
'); opStr.push(''); opStr.push(''); return opStr.join(' '); } - function view(id) { - window.location.href = '/insurer/finance-mng-edit?id=' + id; + function info(id) { + title = '详情'; + layer_show(title, '/insurer/finance-mng-edit?id='+id); + } + function unlock(id) { + parent.layer.confirm('是否确认解锁?', { + btn: ['解锁','取消'], //按钮 + shade: false //不显示遮罩 + }, function(){ + $.post('/insurer/unlocked',{id:id},function(data) { + parent.layer.msg(data.msg); + refreshList(); + }, 'json'); + }, function(){ + // + }); } function refreshList() { $('#listTable').bootstrapTable('refresh'); diff --git a/frontend/views/insurer/search.php b/frontend/views/insurer/search.php index a7704ba..7317720 100644 --- a/frontend/views/insurer/search.php +++ b/frontend/views/insurer/search.php @@ -16,66 +16,57 @@ use \common\libs\MyLib;
-