|
- <?php
-
- namespace backend\modules\api\models;
-
- use yii\db\ActiveRecord;
-
- /**
- * This is the model class for table "order_send_message".
- *
- * @property integer $ID
- * @property integer $ORDER_ID
- * @property string $SEND_MOBILE
- * @property string $SEND_MESSAGE
- * @property string $SEND_TIME
- * @property integer $SEND_ERROR
- * @property integer $CANCEL_FLAG
- * @property integer $CREATE_USER_ID
- * @property string $CREATE_TIME
- * @property integer $UPDATE_USER_ID
- * @property string $UPDATE_TIME
- * @property integer $IS_TOURIST
- */
- class OrderSendMessage extends ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'order_send_message';
- }
-
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['ORDER_ID', 'SEND_MOBILE', 'SEND_MESSAGE', 'SEND_TIME'], 'required'],
- [['ORDER_ID', 'SEND_ERROR', 'CANCEL_FLAG', 'CREATE_USER_ID', 'UPDATE_USER_ID', 'IS_TOURIST'], 'integer'],
- [['SEND_MESSAGE'], 'string'],
- [['SEND_MOBILE'], 'string', 'max' => 11],
- [['SEND_TIME', 'CREATE_TIME', 'UPDATE_TIME'], 'string', 'max' => 20],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'ID' => 'ID',
- 'ORDER_ID' => 'Order ID',
- 'SEND_MOBILE' => 'Send Mobile',
- 'SEND_MESSAGE' => 'Send Message',
- 'SEND_TIME' => 'Send Time',
- 'SEND_ERROR' => 'Send Error',
- 'CANCEL_FLAG' => 'Cancel Flag',
- 'CREATE_USER_ID' => 'Create User ID',
- 'CREATE_TIME' => 'Create Time',
- 'UPDATE_USER_ID' => 'Update User ID',
- 'UPDATE_TIME' => 'Update Time',
- 'IS_TOURIST' => '',
- ];
- }
-
- /**
- * Function Description:添加自由行产品短信记录
- * Function Name: addTouristMsg
- * @param int $order_id
- * @param int $phone
- * @param string $content
- * @param int $send_error
- * @param int $is_tourist
- * @return bool
- *
- * @author 温依莅
- */
- public static function addTouristMsg($order_id, $phone, $content, $send_error, $is_tourist = 0)
- {
- $user_id = 2;
- $time = date('Y-m-d H:i:s');
- $obj = new self();
- $obj->attributes = array(
- 'ORDER_ID' => $order_id,
- 'SEND_MOBILE' => $phone,
- 'SEND_MESSAGE' => $content,
- 'SEND_TIME' => $time,
- 'SEND_ERROR' => $send_error,
- 'CANCEL_FLAG' => 0,
- 'CREATE_USER_ID' => $user_id,
- 'CREATE_TIME' => $time,
- 'UPDATE_USER_ID' => $user_id,
- 'UPDATE_TIME' => $time,
- 'IS_TOURIST' => $is_tourist,
- );
- if(!$obj->insert()){
- return false;
- }
- return true;
- }
- }
|