|
@@ -6,6 +6,37 @@ use Dever;
|
|
|
|
|
|
class Sell
|
|
|
{
|
|
|
+ # 发放业绩
|
|
|
+ public function push_one_commit($mid, $num, $role, $id, $desc)
|
|
|
+ {
|
|
|
+ $this->push($mid, $num, $role, $id, $desc);
|
|
|
+ }
|
|
|
+
|
|
|
+ # 批量发放业绩
|
|
|
+ public function push_all_commit($mid, $num, $role, $id, $desc)
|
|
|
+ {
|
|
|
+ $this->push($mid, $num, $role, $id, $desc);
|
|
|
+
|
|
|
+ $parent = Dever::load('invite/api')->getParentAll($mid);
|
|
|
+ if ($parent) {
|
|
|
+ foreach ($parent as $k => $v) {
|
|
|
+ $this->push($v['uid'], $num, $role, $id, $desc);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ # 发放业绩
|
|
|
+ private function push($mid, $num, $role, $id, $desc)
|
|
|
+ {
|
|
|
+ $this->up($mid, 1, $num, $role, $id, $desc, 2);
|
|
|
+ $this->up($mid, 2, $num, $role, $id, $desc, 2);
|
|
|
+ $where['where_id'] = $mid;
|
|
|
+ $where['group_sell'] = $num;
|
|
|
+ $where['sell'] = $num;
|
|
|
+ return Dever::db('agent/member')->upGroupSellOne($where);
|
|
|
+ }
|
|
|
+
|
|
|
+ # 更新数据
|
|
|
public function up($mid, $type, $num, $role, $type_id, $desc, $stype = 1)
|
|
|
{
|
|
|
if ($num == 0) {
|