|
@@ -144,51 +144,53 @@ class ProductController extends O2oBaseController{
|
|
|
|
|
|
// 保洁师信息处理
|
|
|
// 2015-12-11
|
|
|
- $technician = empty($order->technician) ? 0 : $order->technician;
|
|
|
- $comment->technician = $technician;
|
|
|
+ $technicians = empty($order->technicians) ? null : $order->technicians;
|
|
|
+ $comment->technicians = $technicians;
|
|
|
|
|
|
- if($comment->save()){
|
|
|
+ if($comment->save()) {
|
|
|
$order->have_comment = 1;
|
|
|
- $order->update(array('have_comment'),true);
|
|
|
+ $order->update(array('have_comment'), true);
|
|
|
$data = $comment->parseRow($comment);
|
|
|
$start_time = time();
|
|
|
- $end_time = strtotime(date('Y-m-d',$start_time+1209600));
|
|
|
+ $end_time = strtotime(date('Y-m-d', $start_time + 1209600));
|
|
|
$coupon_ids[] = '56c5914fa84ea0874f8d3820';
|
|
|
$coupon_ids[] = '56c591b1a84ea0dd4e8d411e';
|
|
|
$coupon_ids[] = '56c591e5a84ea04d238cc67b';
|
|
|
$coupon_ids[] = '56c5921ca84ea0b3268bd949';
|
|
|
- Service::factory('CouponService')->giveCoupon($order->user,new MongoId($coupon_ids[mt_rand(0,3)]),$start_time,$end_time);
|
|
|
+ Service::factory('CouponService')->giveCoupon($order->user, new MongoId($coupon_ids[mt_rand(0, 3)]), $start_time, $end_time);
|
|
|
|
|
|
// 保洁师操作
|
|
|
- if ($technician) {
|
|
|
- $technicianObj = TechInfo::get($technician);
|
|
|
- if ($technicianObj && $technicianObj->weixin_userid) {
|
|
|
- $url_prefix = ENVIRONMENT == 'product' ? 'http://api.yiguanjia.me' : 'http://apitest.yiguanjia.me';
|
|
|
- $wechat = O2oApp::getWechatObj();
|
|
|
- $wechat_data = array(
|
|
|
- 'touser' => $technicianObj->weixin_userid,
|
|
|
- 'msgtype' => 'news',
|
|
|
- 'agentid' => '24',
|
|
|
- 'news' => array(
|
|
|
- 'articles' => array(
|
|
|
- array(
|
|
|
- 'title' => '壹管家提示-新评价',
|
|
|
- 'description' => $technicianObj->name.'你好!你刚刚在壹管家O2O服务上收到了一条评分为'.$score.'分的订单评价,请点击查看。',
|
|
|
- 'url' => $url_prefix.'/index.php?r=o2o/myComment/info&order='.$order_id.'&user='.$technician,
|
|
|
+ foreach ($technicians as $technician) {
|
|
|
+ if ($technician) {
|
|
|
+ $technicianObj = TechInfo::get($technician);
|
|
|
+ if ($technicianObj && $technicianObj->weixin_userid) {
|
|
|
+ $url_prefix = ENVIRONMENT == 'product' ? 'http://api.yiguanjia.me' : 'http://apitest.yiguanjia.me';
|
|
|
+ $wechat = O2oApp::getWechatObj();
|
|
|
+ $wechat_data = array(
|
|
|
+ 'touser' => $technicianObj->weixin_userid,
|
|
|
+ 'msgtype' => 'news',
|
|
|
+ 'agentid' => '24',
|
|
|
+ 'news' => array(
|
|
|
+ 'articles' => array(
|
|
|
+ array(
|
|
|
+ 'title' => '壹管家提示-新评价',
|
|
|
+ 'description' => $technicianObj->name . '你好!你刚刚在壹管家O2O服务上收到了一条评分为' . $score . '分的订单评价,请点击查看。',
|
|
|
+ 'url' => $url_prefix . '/index.php?r=o2o/myComment/info&order=' . $order_id . '&user=' . $technician,
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- );
|
|
|
- $wechat->sendMessage($wechat_data);
|
|
|
- }
|
|
|
- // 好评数统计
|
|
|
- if ($score == 5) {
|
|
|
- $favourable_count = $technicianObj->favourable_count + 1;
|
|
|
- $technicianObj->favourable_count = $favourable_count;
|
|
|
- $technicianObj->save();
|
|
|
+ );
|
|
|
+ $wechat->sendMessage($wechat_data);
|
|
|
+ }
|
|
|
+ // 好评数统计
|
|
|
+ if ($score == 5) {
|
|
|
+ $favourable_count = $technicianObj->favourable_count + 1;
|
|
|
+ $technicianObj->favourable_count = $favourable_count;
|
|
|
+ $technicianObj->save();
|
|
|
+ }
|
|
|
}
|
|
|
+ CommonFn::requestAjax(true, CommonFn::getMessage('o2o', 'comment_success'), $data);
|
|
|
}
|
|
|
- CommonFn::requestAjax(true,CommonFn::getMessage('o2o','comment_success'),$data);
|
|
|
}else{
|
|
|
CommonFn::requestAjax(false,CommonFn::getMessage('o2o','comment_failt'));
|
|
|
}
|