|
@@ -165,11 +165,7 @@ class ROrderController extends AdminController{
|
|
$technician_names[] = Yii::app()->request->getParam('extra_add_info_'.$i);
|
|
$technician_names[] = Yii::app()->request->getParam('extra_add_info_'.$i);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // var_dump($technician_names);
|
|
|
|
- //var_dump($technician_names);
|
|
|
|
- // exit();
|
|
|
|
- //$technician_id = intval(Yii::app()->request->getParam('technician', 0));
|
|
|
|
- //$technician_name = Yii::app()->request->getParam('technician_name', '');
|
|
|
|
|
|
+
|
|
|
|
|
|
if(!$counts){
|
|
if(!$counts){
|
|
CommonFn::requestAjax(false, '购买数量错误');
|
|
CommonFn::requestAjax(false, '购买数量错误');
|
|
@@ -345,6 +341,7 @@ class ROrderController extends AdminController{
|
|
//$order->technician = $technician_id;
|
|
//$order->technician = $technician_id;
|
|
//$order->technician_name = $technician_name;
|
|
//$order->technician_name = $technician_name;
|
|
$order->technicians = $technicians;
|
|
$order->technicians = $technicians;
|
|
|
|
+
|
|
// var_dump($order->technicians);exit;
|
|
// var_dump($order->technicians);exit;
|
|
$arr_order = array('cancel_time','refund_time','finish_time','status','booking_time','deal_time','remark', 'station', 'technicians');
|
|
$arr_order = array('cancel_time','refund_time','finish_time','status','booking_time','deal_time','remark', 'station', 'technicians');
|
|
|
|
|
|
@@ -353,7 +350,6 @@ class ROrderController extends AdminController{
|
|
|
|
|
|
// 通知保洁师
|
|
// 通知保洁师
|
|
if (in_array($status, array(1,2,3,4,5)) && $toTech && $success) {
|
|
if (in_array($status, array(1,2,3,4,5)) && $toTech && $success) {
|
|
- // if ($toTech) {
|
|
|
|
foreach($technician_ids as $key => $technician_id) {
|
|
foreach($technician_ids as $key => $technician_id) {
|
|
$technician_obj = TechInfo::get($technician_id);
|
|
$technician_obj = TechInfo::get($technician_id);
|
|
if ($technician_obj && $technician_obj->weixin_userid) {
|
|
if ($technician_obj && $technician_obj->weixin_userid) {
|
|
@@ -680,55 +676,58 @@ class ROrderController extends AdminController{
|
|
|
|
|
|
$orderid = new MongoId($id);
|
|
$orderid = new MongoId($id);
|
|
$order = ROrder::model()->get($orderid);
|
|
$order = ROrder::model()->get($orderid);
|
|
- $toTech = $order->technician != $technician_id ? true : false;
|
|
|
|
- $fromTech = $order->technician;
|
|
|
|
|
|
+ $toTech = isset($order->technicians) ? true : false;
|
|
|
|
+ $fromTechs[] = technician_names;
|
|
//$order->technician = $technician_id;
|
|
//$order->technician = $technician_id;
|
|
//$order->technician_name = $technician_name;
|
|
//$order->technician_name = $technician_name;
|
|
$order->technicians = $technicians;
|
|
$order->technicians = $technicians;
|
|
$success = $order->save(true, array('technicians'));
|
|
$success = $order->save(true, array('technicians'));
|
|
- foreach ($technician_objs as $technician_obj) {
|
|
|
|
|
|
+
|
|
if ($toTech && $success) {
|
|
if ($toTech && $success) {
|
|
- // 发送给被分配保洁师
|
|
|
|
- $wechat = O2oApp::getWechatActive();
|
|
|
|
- $url_prefix = ENVIRONMENT == 'product' ? 'http://api.yiguanjia.me' : 'http://apitest.yiguanjia.me';
|
|
|
|
- if (!empty($technician_obj->weixin_userid)) {
|
|
|
|
- $wechat_data = array(
|
|
|
|
- 'touser' => $technician_obj->weixin_userid,
|
|
|
|
- 'msgtype' => 'news',
|
|
|
|
- 'agentid' => '24',
|
|
|
|
- 'news' => array(
|
|
|
|
- 'articles' => array(
|
|
|
|
- array(
|
|
|
|
- 'title' => '壹管家提示-新订单',
|
|
|
|
- 'description' => $technician_obj->name . '你好!刚刚有一个新的订单被分配给你,请点击查看。',
|
|
|
|
- 'url' => $url_prefix . '/index.php?r=o2o/myOrder/info&order=' . $id . '&user=' . $technician_obj->_id,
|
|
|
|
|
|
+ foreach ($technician_objs as $technician_obj) {
|
|
|
|
+ // 发送给被分配保洁师
|
|
|
|
+ $wechat = O2oApp::getWechatActive();
|
|
|
|
+ $url_prefix = ENVIRONMENT == 'product' ? 'http://api.yiguanjia.me' : 'http://apitest.yiguanjia.me';
|
|
|
|
+ if (!empty($technician_obj->weixin_userid)) {
|
|
|
|
+ $wechat_data = array(
|
|
|
|
+ 'touser' => $technician_obj->weixin_userid,
|
|
|
|
+ 'msgtype' => 'news',
|
|
|
|
+ 'agentid' => '24',
|
|
|
|
+ 'news' => array(
|
|
|
|
+ 'articles' => array(
|
|
|
|
+ array(
|
|
|
|
+ 'title' => '壹管家提示-新订单',
|
|
|
|
+ 'description' => $technician_obj->name . '你好!刚刚有一个新的订单被分配给你,请点击查看。',
|
|
|
|
+ 'url' => $url_prefix . '/index.php?r=o2o/myOrder/info&order=' . $id . '&user=' . $technician_obj->_id,
|
|
|
|
+ ),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
- ),
|
|
|
|
- );
|
|
|
|
- $wechat->sendMessage($wechat_data);
|
|
|
|
|
|
+ );
|
|
|
|
+ $wechat->sendMessage($wechat_data);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// 发送给原保洁师
|
|
// 发送给原保洁师
|
|
- $fromTechObj = TechInfo::get($fromTech);
|
|
|
|
- if (!empty($fromTechObj) && !empty($fromTechObj->weixin_userid)) {
|
|
|
|
- $wechat_data = array(
|
|
|
|
- 'touser' => $fromTechObj->weixin_userid,
|
|
|
|
- 'msgtype' => 'news',
|
|
|
|
- 'agentid' => '24',
|
|
|
|
- 'news' => array(
|
|
|
|
- 'articles' => array(
|
|
|
|
- array(
|
|
|
|
- 'title' => '壹管家提示-订单已被重新分配',
|
|
|
|
- 'description' => $fromTechObj->name . '你好!预定时间在' . date('m月d日H:i', $order->booking_time) . '的订单已被分配给其他保洁师。',
|
|
|
|
- 'url' => $url_prefix . '/index.php?r=o2o/myOrder/info&order=' . $id . '&user=' . $technician_obj->_id,
|
|
|
|
|
|
+ foreach ($fromTechs as $fromTech) {
|
|
|
|
+ $fromTechObj = TechInfo::get($fromTech);
|
|
|
|
+ if (!empty($fromTechObj) && !empty($fromTechObj->weixin_userid)) {
|
|
|
|
+ $wechat_data = array(
|
|
|
|
+ 'touser' => $fromTechObj->weixin_userid,
|
|
|
|
+ 'msgtype' => 'news',
|
|
|
|
+ 'agentid' => '24',
|
|
|
|
+ 'news' => array(
|
|
|
|
+ 'articles' => array(
|
|
|
|
+ array(
|
|
|
|
+ 'title' => '壹管家提示-订单已被重新分配',
|
|
|
|
+ 'description' => $fromTechObj->name . '你好!预定时间在' . date('m月d日H:i', $order->booking_time) . '的订单已被分配给其他保洁师。',
|
|
|
|
+ 'url' => $url_prefix . '/index.php?r=o2o/myOrder/info&order=' . $id . '&user=' . $technician_obj->_id,
|
|
|
|
+ ),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
- ),
|
|
|
|
- );
|
|
|
|
- $wechat->sendMessage($wechat_data);
|
|
|
|
|
|
+ );
|
|
|
|
+ $wechat->sendMessage($wechat_data);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
}
|
|
}
|
|
CommonFn::requestAjax($success, '', array());
|
|
CommonFn::requestAjax($success, '', array());
|
|
}
|
|
}
|