1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Elton
- * Date: 2020/3/17
- * Time: 9:28
- */
- namespace app\common\service;
- use think\Db;
- class SendChannelMsgService
- {
- /**
- * @var SendChannelMsgService
- */
- private static $self;
- /**
- * @return SendChannelMsgService
- */
- public static function instance()
- {
- if(self::$self == NULL){
- self::$self = new self();
- }
- return self::$self;
- }
- /**
- * @param $wx_msg_id 群发的消息ID
- * @param $sentcount 发送成功的粉丝数
- * @param $channel_id 渠道ID
- */
- public function saveSuccessCount($wx_msg_id, $sentcount, $channel_id)
- {
- LogService::info('[ SendChannelMsgService ] [ saveSuccessCount ] wx_msg_id:' . $wx_msg_id . 'sentcount:' . $sentcount . ', Channel_id:' . $channel_id);
- try{
- $rst = Db::name('send_channel_message')->where('wx_msg_id', $wx_msg_id)->where('channel_id', $channel_id)->update(['success_count' => $sentcount]);
- if(!$rst){
- LogService::info('[ SendChannelMsgService ] [ saveSuccessCount ] [ fail ] [ wx_msg_id ] ' . $wx_msg_id);
- }
- }catch (\Exception $exception){
- LogService::error('[ SendChannelMsgService ] [ saveSuccessCount ] ' . $exception->getMessage());
- }
- }
- }
|