Commit e9771a85 by 李洋

fix bug

parent 588c8a89
Showing with 25 additions and 2 deletions
......@@ -12,6 +12,7 @@ use Illuminate\Http\Request;
use App\Http\Requests;
use DB;
use RedisDB;
use Config;
class MessageApiController extends Controller
{
......@@ -39,12 +40,24 @@ class MessageApiController extends Controller
if (empty($data['description'])) {
$this->Export(11002, '请输入模板描述');
}
$is_dumplicated = DB::connection('message')->table('lie_msg_tpl')->where('description',$data['description'])->first();
if($is_dumplicated !== false && empty($insert_tpl_id))
if(empty($insert_tpl_id))
{
if($is_dumplicated !== NULL)
{
$this->Export(11022, '已存在相同模板描述,请更换描述内容');
}
}else
{
$this->Export(11022, '已存在相同模板描述,请更换描述内容');
$is_edit_dumplicated = DB::connection('message')->table('lie_msg_tpl')->where('description',$data['description'])->whereNotIn('tpl_id',[$insert_tpl_id])->first();
if($is_edit_dumplicated !== NULL)
{
$this->Export(11023, '已存在相同模板描述,请更换描述内容');
}
}
//添加事务 保证 数据库多条修改时 原子操作
DB::beginTransaction();
try {
......@@ -211,6 +224,16 @@ class MessageApiController extends Controller
$url = 'http://api.liexin.com/msg/sendMessageByHandle';
// $url = 'http://szapi.ichunt.com/msg/sendMessageByHandle';
// $url = '';
// $current_domain = $_SERVER['HTTP_HOST'];
// if($current_domain === Config('app.api_address')['local'])
// {
// $url = 'http://api.liexin.com/msg/sendMessageByHandle';
// }elseif ($current_domain === Config('app.api_address')['test'])
// {
// $url = 'http://szapi.ichunt.com/msg/sendMessageByHandle';
// }
$params = [];
$params['channels'] = $data['channels'];
$params['msg_type'] = $data['msg_type'];
......
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 sign in to comment