Commit 385e3d0f by 梁建民

js

parents cf5e77cc 7e0b54d0
......@@ -16,5 +16,10 @@ class ApiController extends Controller
private function ApiLogin($request, $id){
Export((new SupplierAccountModel())->Login());
}
//修改密码
private function ApiRestPassword($request, $id){
$yunxin_token = $request->cookie('yunxin_token');
Export((new SupplierAccountModel())->RestPassword());
}
}
......@@ -51,6 +51,16 @@ class HandleController extends Controller
$res = (curl($url,$data));
print_r(\GuzzleHttp\json_decode($res,true));
}
/*
* 发送消息
*/
public function b(){
$data = [
'code'=>"132468",
];
$res = SendMsg($data,'login-code',['13713025362']);//登录验证码
print_r($res);
}
private function hcytest3(){
$conFinance =DB::connection('finance');
......
......@@ -16,6 +16,8 @@ class WebController extends Controller
return view('pc.orderList');
}
$data['id'] = $id;
$data['_URL_'] = config("website.URL_YUNXIN");
$data['_DOMAIN_'] = config("website.domain");
return $this->$id($request,$data,$id);
}
......
......@@ -1108,3 +1108,29 @@ function Deciphering($plain_text,$key){
$decoded=mcrypt_decrypt(MCRYPT_RIJNDAEL_256,$key,base64_decode($plain_text),MCRYPT_MODE_ECB,$iv);
return trim($decoded); // trim删除末尾增加的NULL字节
}
/*
* 发送信息
* @param array $data 替换的内容
* @param string $key 在消息系统新建的模板编号,如:add_tax_success 税率归类成功发送短信
* @param array $ToUser 接收人 [13713025362,13713025363]
*/
function SendMsg($data, $key = '', $ToUser = 'INNER_PERSON'){
if ($key == ""){
return false;
}
$touser_json = json_encode($ToUser);
$check['touser'] = $touser_json;
$check['data'] = urldecode(json_encode($data));
$check['pf'] = -1;
$check['keyword'] = $key;
$check['is_ignore'] = false;
$check['k1']=time();
$check['k2']=MD5(MD5($check['k1']).Config('website.UploadKey'));
$return = curl(config("website.API_DOMAIN").'/msg/sendMessageByAuto', $check);
\App\Model\LogOperationModel::log(["operation_type"=>"1","relevance_type"=>'send_msg',"content"=>$check,"extend1"=>$return]); //日志
$res = json_decode($return,true);
if(empty($res['err_code']) || $res['err_code']!=0) return false;
return true;
}
\ No newline at end of file
<?php
namespace App\Model;
use App\map\OperationLogMap;
use Illuminate\Database\Eloquent\Model;
use Request;
use DB;
class LogOperationModel extends Model
{
protected $connection='yunxin';
protected $table='log_operation';
protected $primaryKey='id';
public $timestamps = false;
//列表
public function getList($export=array())
{
$input = Request::all();
$list = $this->where(function ($query) use ($input) {
foreach ($input as $k => $v){
$v = trim($v);
if (empty($v)){
continue;
}
switch ($k){
case "p":
case "limit":
case "_url":
case "s":
continue;
break;
default:
$query->whereRaw("FIND_IN_SET($k,'".trim($v,',')."') > 0");
break;
}
}
})->orderBy('id','desc')->paginate($input['limit'], ['*'], 'p', $input['p'])->toArray();
if (!$list) return [20001, '没有数据'];
$UserModel = new UserModel();
foreach ($list['data'] as $k=>&$v){
$userName = $UserModel->FinduserInfoName($v['create_uid']);
$v['user_id_name'] = $userName ? $userName : "";
$v['relevance_type_name'] = OperationLogMap::$relevance_type[$v['relevance_type']];
$v['operation_type_name'] = OperationLogMap::$operation_type[$v['operation_type']];
$v['create_time'] = date("Y-m-d H:i:s",$v['create_time']);
}
return [0, '成功', $list['data'], $list['total']];
}
/*
* 插入操作日志
*@param `operation_type` '操作类型:1添加,2删除,3修改,4审核通过,5审核驳回,6导出',
*@param `relevance_type` '关联单据的类型或者模块: 参考 OperationLogMap
*@param `relevance_id` '关联ID',
*@param `relevance_sn` '关联单号',
*@param `content` '内容',
*@param `create_uid` '操作人id',
*@param `create_name` '操作人名称',
* @param `extend1` '扩展字段1',
*/
static function log($data){
$data['operation_type'] = @$data['operation_type'] == "" ? 1: @$data['operation_type'];
$data['relevance_type'] = @$data['relevance_type'];
$data['relevance_id'] =@$data['relevance_id'] == "" ? 0: @$data['relevance_id'];
$data['relevance_sn'] = @$data['relevance_sn'] == "" ? "": @$data['relevance_sn'];
$data['content'] =empty(@$data['content']) ? "" : (is_array(@$data['content']) ? json_encode(@$data['content'],JSON_UNESCAPED_UNICODE) : @$data['content']);
$data['create_uid'] = @$data['create_uid'] == "" ? 0: @$data['relevance_id'];
$data['create_name'] = @$data['create_name'] == "" ? "": @$data['create_name'];
$data['extend1'] = is_array(@$data['extend1']) ? json_encode(@$data['extend1'],JSON_UNESCAPED_UNICODE) : @$data['extend1'];
$data['create_time'] = time();
return self::insert($data);
}
}
\ No newline at end of file
......@@ -78,6 +78,20 @@ class SupplierAccountModel extends Model
return [$e->getCode(),$e->getMessage()];
}
}
/*
* 重置密码
* @param int $account_id 账号id
*/
public function ResetPassword($account_id){
$mobile = Request::input('mobile');
$password = Request::input('password');
$code= Request::input('code');//验证码
$password = createPassword(md5(Config("fixed.supplier_reset_password")));
$result=$this->where("id",$account_id)->update(['password'=>$password]);
return [0,"重置密码成功,密码为:".Config("fixed.supplier_reset_password")];
}
}
\ No newline at end of file
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use RedisDB;
use Request;
use App\map\UploadLogMap;
class UploadLogModel extends Model
{
protected $connection='yunxin';
protected $table='upload_log';
protected $primaryKey='id';
public $timestamps = false;
public function getList($type){
$collert=Request::only('p','limit','type');
$collert=TrimX($collert,true,['p','limit','type']);
$limit=!empty($collert['limit'])?$collert['limit']:10;
$p=!empty($collert['p'])?$collert['p']:1;
//查数据
$UploadLogType = UploadLogMap::$type;
$UploadLogStatus = UploadLogMap::$status;
$list=$this->whereIn('type',$type)->orderBy('id','desc')->paginate($limit,['*'],'p',$p)->toArray();
$UserModel = new UserModel();
foreach ($list['data'] as $key => &$v) {
$v['create_time'] = date('Y/m/d H:i',$v['create_time']);
$v['status'] = @$UploadLogStatus[$v['status']];
$v['type'] = @$UploadLogType[$v['type']];
$v['create_name'] = $UserModel->FinduserInfoName($v['create_id']);
}
return [0,'成功',$list['data'],$list['total']];
}
}
......@@ -2,10 +2,10 @@
#不与线上环境同步
return [
"URL_YUNXIN" => "yunxin.liexin.com",
"URL_FINANCE" => "finance.liexin.com",
"URL_FOOTSTONE" => "foostone.liexin.com",
"URL_PUR" => "pur.liexin.com",
"URL_YUNXIN" => "http://yunxin.liexin.com",
"URL_FINANCE" => "http://finance.liexin.com",
"URL_FOOTSTONE" => "http://foostone.liexin.com",
"URL_PUR" => "http://pur.liexin.com",
"domain" => "liexin.com", //根域名
......@@ -15,6 +15,6 @@ return [
'MD5KEY'=>'LX@ichunt.com82560956-0755',
'API_DOMAIN' => "http://api.ichunt.com" //Api接口地址
];
/**
* Created by hcy on 2019/2/19.
*/
function ResetPassword() {
$.ajax({
url:_URL_+'/api/ApiRestPassword',
type:'post',
data:{
'mobile':$("#mobile").val(),
'password':$.md5($("#password").val()),
'code': $("#code").val()
},
async: false,
dataType:'json',
timeout:10000,
success:function (resp) {
// if(resp.code > 0 ){
// alert(resp.msg)
// }else{
// // setCookie('yunxin_token',resp.data)
// // window.location.href = "/web/orderList"
// }
}
})
return false;
}
......@@ -103,5 +103,3 @@
})(window);
var _URL_ = "http://yunxin.liexin.com";
/*
设置cookie
*/
function setCookie(name,value){
var Days = 30;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*30);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
/*
获取cookie
*/
function getCookie(name){
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg))
return unescape(arr[2]);
else
return null;
}
......@@ -12,6 +12,9 @@
<link rel="stylesheet" type="text/css" href="/pc/font/iconfont.css">
<link rel="stylesheet" type="text/css" href="/pc/js/layui/css/layui.css">
<link rel="stylesheet" type="text/css" href="/pc/css/style.min.css">
<script>
var _URL_ = "<?php echo $_URL_; ?>";
</script>
</head>
<body>
<!--头部-->
......@@ -115,5 +118,7 @@
<!--layer end-->
<script type="text/javascript" src="/pc/js/jquery.min.js"></script>
<script type="text/javascript" src="/pc/js/layui/layui.js"></script>
<script type="text/javascript" src="/pc/js/md5/jquery.md5.js"></script>
<script type="text/javascript" src="/pc/js/global.js"></script>
<script type="text/javascript" src="/pc/js/public.js"></script>
<script src="/pc/js/controller/{{$id}}.js?{{time()}}"></script>
\ No newline at end of file
......@@ -11,6 +11,11 @@
<link rel="stylesheet" type="text/css" href="/pc/font/iconfont.css?v={{ $time }}">
<link rel="stylesheet" type="text/css" href="/pc/js/layui/css/layui.css?v={{ $time }}">
<link rel="stylesheet" type="text/css" href="/pc/css/style.min.css?v={{ $time }}">
<script>
//存放公共变量
var _URL_ = "<?php echo $_URL_; ?>";
var _DOMAIN_ = "<?php echo $_DOMAIN_; ?>";
</script>
</head>
<body>
<!--头部-->
......
......@@ -33,7 +33,7 @@
</div>
<div class="bnt-wrap mt1">
<a href="javascript:;" class="cancel btn lineBlock">取消</a>
<a href="javascript:;" class="ok btn lineBlock">确定</a>
<a href="javascript:;" class="ok btn lineBlock" onclick="ResetPassword()">确定</a>
</div>
</div>
</div>
......
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