|
|
@@ -3,6 +3,7 @@
|
|
|
namespace app\common\model;
|
|
|
|
|
|
use liuniu\BaseModel;
|
|
|
+use liuniu\WechatTempleService;
|
|
|
use think\Exception;
|
|
|
use think\Model;
|
|
|
|
|
|
@@ -52,9 +53,18 @@ class Sos extends BaseModel
|
|
|
$res = self::create($where);
|
|
|
$user_phone = User::where('id', $where['user_id'])->value('mobile');
|
|
|
$rescue_phone = User::where('id', $where['rescuers_user_id'])->value('mobile');
|
|
|
- $rescuers_id = Rescue::where('uid',$where['rescuers_user_id'])->value('id');
|
|
|
+ $rescuers_id = Rescue::where('user_id',$where['rescuers_user_id'])->value('id');
|
|
|
$res1 = SosBill::income($where['cid'], $where['user_id'], $res['id'], $rescuers_id,$where['rescuers_user_id'], $where['latitude'], $where['longitude'], $user_phone, $rescue_phone,$where['address']);
|
|
|
//tudo 模板信息
|
|
|
+ if($where['form'] == "weixin") {
|
|
|
+ $data['first'] = "有人向你发起求救";
|
|
|
+ $data['keyword1'] = $user_phone;
|
|
|
+ $data['keyword2'] = $where['address'];
|
|
|
+ $data['keyword3'] = date("Y-m-d H:i:s");
|
|
|
+ $data['keyword4'] = "";
|
|
|
+ $data['remark'] ="详细请点信息";
|
|
|
+ WechatTempleService::sendTemplate($where['cid'], UserRelation::userIdToOpenId('rescuers_user_id'), WechatTempleService::EMERGANCY_RESCUE,$data,$where['re_url']);
|
|
|
+ }
|
|
|
if($res && $res1)
|
|
|
{
|
|
|
self::commitTrans();
|