作者 Your Name

online change

... ... @@ -3,10 +3,10 @@ debug = true
trace = false
[database]
hostname = rm-m5eblhc9o3515i25neo.mysql.rds.aliyuncs.com
database = yangsheng
username = db136s1ehvo1yn73
password = cxz307311SJK
hostname = 127.0.0.1
database = yangshengyihou_c
username = root
password = 3bcd82661fd38552
hostport = 3306
prefix = fa_
... ...
... ... @@ -569,7 +569,6 @@ class Clock extends Api
$user= \addons\third\model\Third::get(['user_id'=>$insert['user_id']]);
$notify_url=url('/api/common/notifyx','','',true);
$info['fee']=0.01;
$params = [
'amount'=>"$info[fee]",
// 'amount'=>'0.01',
... ...
... ... @@ -222,13 +222,13 @@ class Shop extends Api
})
*/
public function getAddressInfo(){
$map['id']=input('address_id');
$map['user_id']=$this->auth->id;
$address=UserAddress::get($map);
if (empty($address)){
$this->error('地址不存在');
}
$this->success('',$address);
$map['id']=input('address_id');
$map['user_id']=$this->auth->id;
$address=UserAddress::get($map);
if (empty($address)){
$this->error('地址不存在');
}
$this->success('',$address);
}
... ... @@ -285,11 +285,11 @@ class Shop extends Api
$map1['user_id']=$user_id;
$map1['defaultswitch']=1;
$update1['defaultswitch']=0;
$address=$UserAddress->get($map1);
if(!empty($address)){
$address->save($update1);
}
$UserAddress->get($map)->save($update);
$address=$UserAddress->get($map1);
if(!empty($address)){
$address->save($update1);
}
$UserAddress->get($map)->save($update);
$this->success('设置成功!');
}
... ... @@ -314,7 +314,7 @@ class Shop extends Api
if (empty($one)){
$this->error('地址不存在');
}
$result=$one->delete();
$result=$one->delete();
if ($result>0){
$this->success('操作成功!');
}else{
... ... @@ -469,100 +469,95 @@ class Shop extends Api
case 2: //现金支付
//需要查看用户积分数量 判断出现金支付金额
if ($good['good_data']==2){
$this->error('现金类型商品无法用现金支付');
$this->error('现金类型商品无法用现金支付');
}
if ($user['score']>=($good['price']*$site['good_ratio'])){
$real_fee=0;
$cost_score=$good['price']*$site['good_ratio'];
/*扣除相应积分*/
$insert['order_sn']=cmf_get_order_sn();
$insert['user_id']=$user_id;
$insert['user_name']=$address['user_name'];
$insert['tel']=$address['tel'];
$insert['address']=$address['address'];
$insert['good_id']=$good_id;
$insert['score']=$cost_score;
$insert['price']=$real_fee;
$insert['status']=1;
$insert['pay_type']=2;
Db::startTrans();
try{
Orders::create($insert);
$User->where('id',$user_id)->setDec('score',$good['price']);
$insert_log['user_id']=$user_id;
$insert_log['score']=0-$good['price'];
$insert_log['memo']='积分兑换';
$Goods=new Goods();
$Goods->where('id',$good_id)->setDec('kucun');
ScoreLog::create($insert_log);
// 提交事务
Db::commit();
} catch (\Exception $e) {
// 回滚事务
dump($e->getMessage());
Db::rollback();
$this->error('支付失败!');
}
$this->success('支付成功!');
}else{
$real_fee=ceil(($good['money']-$user['score']/$site['good_ratio'])*100)/100;
$cost_score=$user['score'];
$insert['order_sn']=cmf_get_order_sn();
$insert['user_id']=$user_id;
$insert['user_name']=$address['user_name'];
$insert['tel']=$address['tel'];
$insert['address']=$address['address'];
$insert['good_id']=$good_id;
$insert['score']=$cost_score;
$insert['price']=$real_fee;
$insert['status']=0;
$insert['pay_type']=2;
Db::startTrans();
try{
Orders::create($insert);
$User->where('id',$user_id)->setDec('score',$cost_score);
$insert_log['user_id']=$user_id;
$insert_log['score']=0-$cost_score;
$insert_log['memo']='积分兑换';
$Goods=new Goods();
$Goods->where('id',$good_id)->setDec('kucun');
ScoreLog::create($insert_log);
// 提交事务
Db::commit();
} catch (\Exception $e) {
// 回滚事务
dump($e->getMessage());
Db::rollback();
$this->error('支付失败!');
}
$third=Third::get(['user_id'=>$user_id]);
/*调用微信支付*/
$notify_url=url('/api/common/notifyx1','','',true);
$params = [
<<<<<<< HEAD
if ($user['score']>=($good['price']*$site['good_ratio'])){
$real_fee=0;
$cost_score=$good['price']*$site['good_ratio'];
/*扣除相应积分*/
$insert['order_sn']=cmf_get_order_sn();
$insert['user_id']=$user_id;
$insert['user_name']=$address['user_name'];
$insert['tel']=$address['tel'];
$insert['address']=$address['address'];
$insert['good_id']=$good_id;
$insert['score']=$cost_score;
$insert['price']=$real_fee;
$insert['status']=1;
$insert['pay_type']=2;
Db::startTrans();
try{
Orders::create($insert);
$User->where('id',$user_id)->setDec('score',$good['price']);
$insert_log['user_id']=$user_id;
$insert_log['score']=0-$good['price'];
$insert_log['memo']='积分兑换';
$Goods=new Goods();
$Goods->where('id',$good_id)->setDec('kucun');
ScoreLog::create($insert_log);
// 提交事务
Db::commit();
} catch (\Exception $e) {
// 回滚事务
dump($e->getMessage());
Db::rollback();
$this->error('支付失败!');
}
$this->success('支付成功!');
}else{
$real_fee=ceil(($good['money']-$user['score']/$site['good_ratio'])*100)/100;
$cost_score=$user['score'];
$insert['order_sn']=cmf_get_order_sn();
$insert['user_id']=$user_id;
$insert['user_name']=$address['user_name'];
$insert['tel']=$address['tel'];
$insert['address']=$address['address'];
$insert['good_id']=$good_id;
$insert['score']=$cost_score;
$insert['price']=$real_fee;
$insert['status']=0;
$insert['pay_type']=2;
Db::startTrans();
try{
Orders::create($insert);
$User->where('id',$user_id)->setDec('score',$cost_score);
$insert_log['user_id']=$user_id;
$insert_log['score']=0-$cost_score;
$insert_log['memo']='积分兑换';
$Goods=new Goods();
$Goods->where('id',$good_id)->setDec('kucun');
ScoreLog::create($insert_log);
// 提交事务
Db::commit();
} catch (\Exception $e) {
// 回滚事务
dump($e->getMessage());
Db::rollback();
$this->error('支付失败!');
}
$third=Third::get(['user_id'=>$user_id]);
/*调用微信支付*/
$notify_url=url('/api/common/notifyx1','','',true);
$params = [
'amount'=>$real_fee,
=======
/* 'amount'=>$real_fee,*/
'amount'=>0.01,
>>>>>>> 59772386ba3ea29fef294ae3f7567114ff84f119
'orderid'=>"$insert[order_sn]",
'type'=>"wechat",
'title'=>"$good[good_name]",
'notifyurl'=>$notify_url,
'returnurl'=>$notify_url,
'method'=>"miniapp",
'openid'=>"$third->openid",
'auth_code'=>"1111"
];
$payment=\addons\epay\library\Service::submitOrder($params);
$payment=json_decode($payment,true);
$this->success('支付信息',$payment);
}
'orderid'=>"$insert[order_sn]",
'type'=>"wechat",
'title'=>"$good[good_name]",
'notifyurl'=>$notify_url,
'returnurl'=>$notify_url,
'method'=>"miniapp",
'openid'=>"$third->openid",
'auth_code'=>"1111"
];
$payment=\addons\epay\library\Service::submitOrder($params);
$payment=json_decode($payment,true);
$this->success('支付信息',$payment);
}
break;
default;
}
... ... @@ -648,5 +643,5 @@ class Shop extends Api
$this->success('操作成功!');
}
}
}
\ No newline at end of file
... ...
... ... @@ -16,15 +16,15 @@ return [
// 数据库类型
'type' => Env::get('database.type', 'mysql'),
// 服务器地址
'hostname' => Env::get('database.hostname', '127.0.0.1'),
'hostname' => Env::get('database.hostname', 'localhost'),
// 数据库名
'database' => Env::get('database.database', 'yangsheng'),
'database' => Env::get('database.database', 'yangshengyihou_c'),
// 用户名
'username' => Env::get('database.username', 'root'),
// 密码
'password' => Env::get('database.password', ''),
'password' => Env::get('database.password', '3bcd82661fd38552'),
// 端口
'hostport' => Env::get('database.hostport', ''),
'hostport' => Env::get('database.hostport', '3306'),
// 连接dsn
'dsn' => '',
// 数据库连接参数
... ...
... ... @@ -35,7 +35,7 @@ return array (
'mail_smtp_pass' => 'password',
'mail_verify_type' => '2',
'mail_from' => '914748691@qq.com',
'ratio' => '20000',
'ratio' => '2',
'early_time' => '30',
'range' => '1000',
'message' => '完成挑战即获得2~5倍加油金的现金奖励,最高500元,可微信提现!',
... ...