1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- use app\common\model\PushSmsMon;
- class PushLog extends BaseModel {
- const SEND_SMS = 1;
- const SEND_SYSTEM = 2;
- const SEND_PUSH = 3;
- const SEND_TMP_PUSH = 4;
- const SEND_SMS_MON = 5;
- const SEND_SMS_ZP_ACTIVITY = 6;
- // public static $tableName = 'push_logs';
- protected $name = 'push_logs';
- //content,mobiles,pub_name 必选参数--梦网群发短信
- public static function addSmsMon($content,$mobiles,$pubName,$isAll=0,$paramArray = [],$tmp_id = 0) {
- if(empty($isAll)&&empty($mobiles)){
- return false;
- }
- if(empty($content)){
- return false;
- }
- if(strlen($mobiles)>0&&$isAll==1){
- return false;
- }
- $remark = count(explode(',',$mobiles)).'人';
-
- $data = [
- 'ftype' => PushLog::SEND_SMS_MON,
- 'description' => $mobiles,
- 'pub_name' => $pubName,
- 'is_all'=>$isAll,
- 'content'=>$content,
- 'remark'=>$remark,
- 'sms_param'=>json_encode($paramArray),
- 'target_id'=>$tmp_id,
- 'total_receivers'=>0,//
- ];
- $id = Db::name("push_logs")->insertGetId($data);
- $pushLog = PushLog::where("id",$id)->find();
- $mon = new PushSmsMon;
- $mon->send($pushLog);
- return $id;
- }
- }
|