Commit 35d606af authored by hujun's avatar hujun

推送报备信息

parent 3907f317
This diff is collapsed.
......@@ -11,6 +11,7 @@ namespace app\index\controller;
use app\api\untils\GeTuiUntils;
use app\index\extend\Basic;
use app\model\Agents;
use app\model\Applies;
use app\model\AppointWatchShop;
use app\model\HouseInfos;
......@@ -70,7 +71,7 @@ class WatchShop extends Basic
$appoint_watch = new AppointWatchShop();
$appoint_watch->startTrans();
$apponit_data = $appoint_watch->get($params['watch_id'])->lock();
$apponit_data = $appoint_watch->lock(true)->where('id',$params['watch_id'])->find();
if ($apponit_data['id']) {
$apples = new Applies();
......@@ -91,7 +92,7 @@ class WatchShop extends Basic
'apply_id' => $apples->id,
'shopuser_id' => $params['agents_id'],
'shop_id' => $params['shop_id'],
'house_id' => $params['house_id'],
'house_id' => $apponit_data['house_id'],
'transaction_status' => 0,
'created' => date("Y-m-d H:i:s")
])->save();
......@@ -103,8 +104,16 @@ class WatchShop extends Basic
if ($apples->id && $remark->id) {
$appoint_watch->commit();
//推送报备信息
$agent = new Agents();
$agentData = $agent->field('id,device_id,realname,agentshopname,sub_shopname')->where('id',$params['agents_id'])->find();
$title = '报备提醒';
$content = '【'.$agentData['agentshopname'].$agentData['sub_shopname']. '-' . $agentData['realname'] . '】报备了【' . $apponit_data['house_title'].'】';
$get = new GeTuiUntils();
$req = $get->public_push_message_for_one($params['agents_id'],$agentData['device_id'],$title,$content);
$data['status'] = 200;
$data['msg'] = '报备成功';
$data['msg'] = $req['result'] == 'ok' ? '报备成功并通知经纪人' : '报备成功,请通知经纪人';
} else {
$appoint_watch->rollback();
$data['status'] = 101;
......@@ -122,7 +131,11 @@ class WatchShop extends Basic
}
public function test(){
$agent = new Agents();
$agent->
$get = new GeTuiUntils();
$get->pushMessageToApp();
$title='报备提醒';
dump($get->public_push_message_for_one(8,'hello world','测试'));die;
}
}
\ No newline at end of file
......@@ -110,9 +110,14 @@ define (['doT', 'text!temp/watch_template_tpl.html', 'css!style/home.css',"datet
$ (document).delegate (".add_applies", "click", function () {
user.watch_id = $(this).attr ("data-id");
$("input[name='phone']").val('');
});
$ (document).delegate ("#submit_applies", "click", function () {
if ($('input[name="phone"]').val() == '') {
alert('报备人信息不能为空');
return ;
}
var params = {};
params.shop_id = user.father_id;
params.agents_id = user.agents_id;
......@@ -124,9 +129,13 @@ define (['doT', 'text!temp/watch_template_tpl.html', 'css!style/home.css',"datet
data: params,
dataType: 'json',
success: function (data) {
if (data.code == 200) {
alert(data.msg);
$("#modal-watch").modal ('hide');
user.getList(1);
} else {
alert(data.msg);
}
}
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment