Commit d5f50ece authored by hujun's avatar hujun

新增分佣提成

parent 47a0d497
......@@ -171,7 +171,7 @@ class Finance extends Basic
$data['msg'] = 'Id is null.';
} else {
$bargain = new OBargainModel();
$update_data['commission'] = empty($this->params['commission']) ? 0 : $this->params['commission'];
$update_data['scale_fee'] = empty($this->params['scale_fee']) ? 0 : $this->params['scale_fee'];
$update_data['practical_fee'] = empty($this->params['practical_fee']) ? 0 : $this->params['practical_fee'];
$data['data'] = $bargain->updateBargainById($this->params['id'], $update_data);
......@@ -183,4 +183,36 @@ class Finance extends Basic
return $this->response($data['code'], $data['msg'], $data['data']);
}
/**
* 新增分佣提成
*
* @return \think\Response
*/
public function addBargain() {
$data['code'] = 200;
$data['msg'] = "";
$data['data'] = [];
if (empty($this->params['id'])) {
$data['code'] = 101;
$data['msg'] = 'Id is null.';
} else {
$bargain = new OBargainModel();
$update_data['role'] = empty($this->params['role']) ? 0 : $this->params['role'];
$update_data['scale_fee'] = empty($this->params['commission']) ? 0 : $this->params['scale_fee'];
$update_data['practical_fee'] = empty($this->params['practical_fee']) ? 0 : $this->params['practical_fee'];
$update_data['father_id'] = empty($this->params['id']) ? 0 : $this->params['id'];
$update_data['scale'] = empty($this->params['scale']) ? 0 : $this->params['scale'];
$update_data['id'] = empty($this->params['id']) ? 0 : $this->params['id'];
$data['data'] = $bargain->insertBargain($update_data);
if ($data['data'] == 0) {
$data['code'] = 101;
$data['msg'] = 'Add the failure.';
}
}
return $this->response($data['code'], $data['msg'], $data['data']);
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: fu ju
* Date: 2018/1/20
* Time: 17:52
*/
namespace app\model;
use think\Db;
class OCheckBargain extends BaseModel
{
protected $table = 'o_check_bargain';
}
\ No newline at end of file
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