|
- <?php
- /**
- *
- * ============================================================================
- * * 版权所有 蜘蛛出行 * *
- * 网站地址: http://www.zhizhuchuxing.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
- * 使用;不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * Author By: 温依莅
- * PhpStorm MsgController.php
- * Create By 2017/2/23 10:03 $
- */
-
- namespace backend\modules\api\controllers;
-
- use backend\modules\api\models\OperaMessageTemplate;
- use backend\modules\zzcs\models\OrderMain;
- use common\models\Msg;
- use yii\web\Controller;
- use Yii;
-
- class MsgController extends Controller
- {
- public $enableCsrfValidation = false;
-
- /**
- * Function Description:入口文件
- * Function Name: actionIndex
- *
- * @return bool
- *
- * @author 温依莅
- */
- public function actionIndex()
- {
- return 'hello me';
- }
-
- /**
- * Function Description:下单发短信接口
- * Function Name: actionOrderSendMsg
- *
- * @return string
- *
- * @author 温依莅
- */
- public function actionOrderSendMsg()
- {
- //1,获取订单号
- $order_id = Yii::$app->request->post('order_id', -1);
- $msg_type = Yii::$app->request->post('msg_type', -1);
- if ($order_id == -1 || $msg_type == -1) {
- $json["code"] = '1';
- $json["info"] = '缺少参数';
- return json_encode($json);
- }
- //2,调用model发送短信
- $msg = new OperaMessageTemplate();
- $res = $msg->orderSendMsg($order_id);
- return json_encode($res);
- }
-
- /**
- * Function Description:下单发短信成功接口
- * Function Name: actionOrderSendSuccessMsg
- *
- * @return string
- *
- * @author Redstop
- */
- public function actionOrderSendSuccessMsg()
- {
- //1,获取订单号
- $order_id = Yii::$app->request->post('order_id', -1);
- if ($order_id == -1) {
- $json["code"] = '1';
- $json["info"] = '缺少参数';
- return json_encode($json);
- }
- //2,调用model发送短信
- $msg = new OperaMessageTemplate();
- $send_msg_info = $msg->getMsgInfo($order_id, 'four');
- if ($send_msg_info != "notSend") {
- $msg->addSuccessMessage($order_id, $send_msg_info[1], $send_msg_info[2]);
- }
- $json["code"] = '0';
- $json["info"] = '插入发送列表成功';
- return json_encode($json);
- }
-
- /**
- * Function Description:下单发短信成功接口
- * Function Name: actionOrderSendSuccessMsg
- *
- * @return string
- *
- * @author Redstop
- */
- public function actionGroupOrderSendSuccessMsg()
- {
- //1,获取订单号
- $order_id = Yii::$app->request->post('order_id', -1);
- if ($order_id == -1) {
- $json["code"] = '1';
- $json["info"] = '缺少参数';
- return json_encode($json);
- }
- //2,调用model发送短信
- $msg = new OperaMessageTemplate();
- $send_msg_info = $msg->getGroupSuccessMsgInfo($order_id);
- if ($send_msg_info != false) {
- $msg->addSuccessMessage($order_id, $send_msg_info[1], $send_msg_info[2]);
- }
- $json["code"] = '0';
- $json["info"] = '插入发送列表成功';
- return json_encode($json);
- }
-
- /**
- * Function Description:组合订单下单 发短信接口(发送出行短信)
- * Function Name: actionGroupOrderSendMsg
- *
- * @return string
- *
- * @author 温依莅
- */
- public function actionGroupOrderSendMsg()
- {
- //1,获取订单号
- $order_id = Yii::$app->request->post('order_id', -1);
- $msg_type = Yii::$app->request->post('msg_type', -1);
- $template_type = Yii::$app->request->post('template_type', 'two');
- if ($order_id == -1 || $msg_type == -1) {
- $json["code"] = '1';
- $json["info"] = '缺少参数';
- return json_encode($json);
- }
- //2,调用model发送短信
- $msg = new OperaMessageTemplate();
- $res = $msg->orderSendMsg($order_id, $template_type);
- return json_encode($res);
- }
-
- /**
- * Function Description:ota获取短信内容(预定短信)
- * Function Name: actionGetMsgInfo
- *
- * @return string
- *
- * @author 温依莅
- */
- public function actionGetMsgInfo()
- {
- //1,获取订单号
- $order_id = Yii::$app->request->post('order_id', -1);
- if ($order_id == -1) {
- $json["code"] = '1';
- $json["info"] = '缺少参数';
- return json_encode($json);
- }
- //2,调用model获取短信内容(预定短信)
- $msg = new OperaMessageTemplate();
- $res = $msg->otaGetMsgInfo($order_id);
- return json_encode($res);
- }
-
- /**
- * Function Description:ota获取短信内容(出行短信)
- * Function Name: actionGetMsgInfo2
- *
- * @return string
- *
- * @author 温依莅
- */
- public function actionGetMsgInfo2()
- {
- //1,获取订单号
- $order_id = Yii::$app->request->post('order_id', -1);
- if ($order_id == -1) {
- $json["code"] = '1';
- $json["info"] = '缺少参数';
- return json_encode($json);
- }
- //2,调用model获取短信内容(出行短信)
- $msg = new OperaMessageTemplate();
- $res = $msg->otaGetMsgInfo($order_id, 'two');
- return json_encode($res);
- }
-
-
- /**
- * Function Description:车队临时换车时发送给乘客出行提醒短信以及给运营人员提醒短信
- * Function Name: actionSendBusChangeMessage
- *
- * @return string
- *
- * @author 温依莅
- */
- public function actionSendBusChangeMessage()
- {
- $json = array();
- $json["code"] = '0';
- return json_encode($json);
- // //1,获取订单号
- // $run_id = Yii::$app->request->post('run_id', -1);
- // $bus_order_id = Yii::$app->request->post('bus_order_id', -1);
- // $send_bus_count = Yii::$app->request->post('send_bus_count', 1);
- // $itinerary_name = Yii::$app->request->post('itinerary_name');
- // $run_start_time = Yii::$app->request->post('run_start_time');
- // $new_bus_no = Yii::$app->request->post('new_bus_no');
- // if ($run_id == -1 || $bus_order_id == -1) {
- // $json["code"] = '1';
- // $json["info"] = '缺少参数';
- // return json_encode($json);
- // }
- // //2,发送预警短信
- // $msg = new OperaMessageTemplate();
- // $msg->sendBusChangeRemindMsg($run_start_time, $itinerary_name, $new_bus_no);
- // //发送新出行提醒短信
- // $msg->sendNewUserRemindMsg($run_id, $bus_order_id, $send_bus_count);
- }
-
- /**
- * Function Description:发送自由编辑短信接口
- * Function Name: actionSendFreeMsg
- *
- * @return string
- *
- * @author 邱颂
- */
- public function actionSendFreeMsg()
- {
- //1,获取订单号
- $order_id = Yii::$app->request->post('order_id', -1);
- $user_id = Yii::$app->request->post('user_id', -1);
- $send_message = Yii::$app->request->post('send_message', '');
- if ($order_id == -1 || $user_id == -1 || $send_message == '' ) {
- $json["code"] = '1';
- $json["info"] = '缺少参数';
- return json_encode($json);
- }
- //2,调用model发送短信
- $msg = new OperaMessageTemplate();
- $res = $msg->orderSendFreeMsg($order_id, $user_id, $send_message);
- return json_encode($res);
- }
-
- }
|