Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

105 строки
2.8 KiB

  1. <?php
  2. namespace backend\modules\api\models;
  3. use yii\db\ActiveRecord;
  4. /**
  5. * This is the model class for table "order_send_message".
  6. *
  7. * @property integer $ID
  8. * @property integer $ORDER_ID
  9. * @property string $SEND_MOBILE
  10. * @property string $SEND_MESSAGE
  11. * @property string $SEND_TIME
  12. * @property integer $SEND_ERROR
  13. * @property integer $CANCEL_FLAG
  14. * @property integer $CREATE_USER_ID
  15. * @property string $CREATE_TIME
  16. * @property integer $UPDATE_USER_ID
  17. * @property string $UPDATE_TIME
  18. * @property integer $IS_TOURIST
  19. */
  20. class OrderSendMessage extends ActiveRecord
  21. {
  22. /**
  23. * @inheritdoc
  24. */
  25. public static function tableName()
  26. {
  27. return 'order_send_message';
  28. }
  29. /**
  30. * @inheritdoc
  31. */
  32. public function rules()
  33. {
  34. return [
  35. [['ORDER_ID', 'SEND_MOBILE', 'SEND_MESSAGE', 'SEND_TIME'], 'required'],
  36. [['ORDER_ID', 'SEND_ERROR', 'CANCEL_FLAG', 'CREATE_USER_ID', 'UPDATE_USER_ID', 'IS_TOURIST'], 'integer'],
  37. [['SEND_MESSAGE'], 'string'],
  38. [['SEND_MOBILE'], 'string', 'max' => 11],
  39. [['SEND_TIME', 'CREATE_TIME', 'UPDATE_TIME'], 'string', 'max' => 20],
  40. ];
  41. }
  42. /**
  43. * @inheritdoc
  44. */
  45. public function attributeLabels()
  46. {
  47. return [
  48. 'ID' => 'ID',
  49. 'ORDER_ID' => 'Order ID',
  50. 'SEND_MOBILE' => 'Send Mobile',
  51. 'SEND_MESSAGE' => 'Send Message',
  52. 'SEND_TIME' => 'Send Time',
  53. 'SEND_ERROR' => 'Send Error',
  54. 'CANCEL_FLAG' => 'Cancel Flag',
  55. 'CREATE_USER_ID' => 'Create User ID',
  56. 'CREATE_TIME' => 'Create Time',
  57. 'UPDATE_USER_ID' => 'Update User ID',
  58. 'UPDATE_TIME' => 'Update Time',
  59. 'IS_TOURIST' => '',
  60. ];
  61. }
  62. /**
  63. * Function Description:添加自由行产品短信记录
  64. * Function Name: addTouristMsg
  65. * @param int $order_id
  66. * @param int $phone
  67. * @param string $content
  68. * @param int $send_error
  69. * @param int $is_tourist
  70. * @return bool
  71. *
  72. * @author 温依莅
  73. */
  74. public static function addTouristMsg($order_id, $phone, $content, $send_error, $is_tourist = 0)
  75. {
  76. $user_id = 2;
  77. $time = date('Y-m-d H:i:s');
  78. $obj = new self();
  79. $obj->attributes = array(
  80. 'ORDER_ID' => $order_id,
  81. 'SEND_MOBILE' => $phone,
  82. 'SEND_MESSAGE' => $content,
  83. 'SEND_TIME' => $time,
  84. 'SEND_ERROR' => $send_error,
  85. 'CANCEL_FLAG' => 0,
  86. 'CREATE_USER_ID' => $user_id,
  87. 'CREATE_TIME' => $time,
  88. 'UPDATE_USER_ID' => $user_id,
  89. 'UPDATE_TIME' => $time,
  90. 'IS_TOURIST' => $is_tourist,
  91. );
  92. if(!$obj->insert()){
  93. return false;
  94. }
  95. return true;
  96. }
  97. }