Income.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  1. <?php
  2. /**
  3. * Income.php UTF-8
  4. * 玩家渠道收益计算
  5. *
  6. * @date : 2017/9/29 22:55
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 7.5
  11. * Added by wuyonghong BEGIN 2017/10/12 ISSUES:3772 玩家渠道、渠道收益计算重写
  12. */
  13. namespace huo\controller\finance;
  14. use huo\controller\agent\Agent;
  15. use huo\controller\agent\AgentCache;
  16. use huo\controller\agent\AgentOrder;
  17. use huo\controller\member\MemCache;
  18. use huo\controller\pay\SdkOrderCache;
  19. use huo\controller\rate\PtbRate;
  20. use huo\controller\rate\Rate;
  21. use huo\model\agent\AgentCpaLogModel;
  22. use huo\model\finance\GmChargeModel;
  23. use huo\model\finance\PtbAgentChargeModel;
  24. use huo\model\finance\PtbChargeModel;
  25. use huo\model\member\MemoauthModel;
  26. use huolib\constant\AgentConst;
  27. use huolib\constant\CommonConst;
  28. use huolib\constant\GameConst;
  29. use huolib\constant\OrderConst;
  30. use huolib\constant\WalletConst;
  31. use huolib\status\CommonStatus;
  32. use huolib\status\OrderStatus;
  33. use huolib\status\SettleStatus;
  34. use huolib\tool\StrUtils;
  35. use think\Log;
  36. class Income {
  37. /**
  38. * 从玩家游戏充值中计算收益
  39. *
  40. * @param string $order_id
  41. *
  42. * @return bool
  43. */
  44. public function incomeFromSdkOrder($order_id) {
  45. if (empty($order_id)) {
  46. $_code = OrderStatus::ORDER_NOT_EXISTS;
  47. return $_code;
  48. }
  49. $_order_data = SdkOrderCache::ins()->getInfoByOrderId($order_id);
  50. if (empty($_order_data)) {
  51. $_code = OrderStatus::ORDER_NOT_EXISTS;
  52. return $_code;
  53. }
  54. if (OrderConst::PAY_SWITCH_YES == $_order_data['is_switch']) {
  55. $_code = SettleStatus::ORDER_IS_SWITCH;
  56. Log::write(
  57. "func=".__FUNCTION__."&class=".__CLASS__."&code=".$_code.'&msg='.SettleStatus::getMsg($_code)."&order="
  58. .http_build_query($_order_data),
  59. LOG::LOG
  60. );
  61. return $_code;
  62. }
  63. if (OrderConst::PAY_STATUS_SUC != $_order_data['status']) {
  64. $_code = SettleStatus::ORDER_NOT_PAYED;
  65. Log::write(
  66. "func=".__FUNCTION__."&class=".__CLASS__."&code=".$_code.'&msg='.SettleStatus::getMsg($_code)."&order="
  67. .http_build_query($_order_data),
  68. LOG::ERROR
  69. );
  70. return $_code;
  71. }
  72. $_aor_class = new AoRequest();
  73. $_aor_class->setDataFromSdkOrder($_order_data);
  74. $_agent_id = $_aor_class->getAgentId();
  75. $_agent_class = new Agent();
  76. $_role_type = $_agent_class->getRoleType($_agent_id);
  77. if (!empty($_agent_id) && empty($_role_type)) {
  78. $_code = SettleStatus::INNER_ERROR;
  79. Log::write(
  80. "func=".__FUNCTION__."&class=".__CLASS__."&code=".$_code.'&role_type=error&msg='.SettleStatus::getMsg(
  81. $_code
  82. )."&order="
  83. .http_build_query($_order_data),
  84. LOG::ERROR
  85. );
  86. return $_code;
  87. }
  88. /* 玩家游戏充值 */
  89. $_rate_class = new Rate($_aor_class->getAppId(), $_aor_class->getAgentId());
  90. if (GameConst::RATE_AGENT_BENEFIT_REBATE != $_rate_class->getAgentBenefitType()) {
  91. $_code = SettleStatus::INNER_ERROR;
  92. /* 非CPS 模式不计算收益 */
  93. Log::write(
  94. "func=".__FUNCTION__."&class=".__CLASS__."&code=".$_code.'&role_type=error&msg='.SettleStatus::getMsg(
  95. $_code
  96. )."&order="
  97. .http_build_query($_order_data),
  98. LOG::ERROR
  99. );
  100. return $_code;
  101. }
  102. $_ai_class = new AgentIncome();
  103. if (AgentConst::ROLE_TYPE_GROUP == $_role_type) {
  104. /* 一级渠道的直接玩家 */
  105. $_aor_class->setParentId($_aor_class->getAgentId());
  106. $_aor_class->setParentRebate($_rate_class->getAgentRebate());
  107. return $_ai_class->setLevelOne($_aor_class);
  108. } else if (AgentConst::ROLE_TYPE_AGENT == $_role_type) {
  109. /* 二级渠道的直接玩家 */
  110. $_aor_class->setAgentRebate($_rate_class->getAgentRebate());
  111. $_parent_id = $_agent_class->getParentId($_agent_id);
  112. $_parent_role_type = $_agent_class->getRoleType($_parent_id);
  113. if (AgentConst::ROLE_TYPE_GROUP == $_parent_role_type) {
  114. $_aor_class->setParentId($_parent_id);
  115. $_rate_class = new Rate($_aor_class->getAppId(), $_aor_class->getParentId());
  116. $_aor_class->setParentRebate($_rate_class->getAgentRebate());
  117. }
  118. return $_ai_class->setLevelTwo($_aor_class);
  119. } else if (AgentConst::ROLE_TYPE_MEMBER == $_role_type) {
  120. $_aor_class->setFlag($_aor_class::FLAG_MEM_MEM_SDK);
  121. $_deduct_fee = 0;
  122. // TODO: wuyonghong 2018/5/14 计算积分价值
  123. $_parent_id = $_agent_class->getParentId($_agent_id);
  124. if (empty($_parent_id)) {
  125. /* 官方渠道不需计算 */
  126. return SettleStatus::NO_ERROR;
  127. }
  128. $_aor_class->setAgentId($_parent_id);
  129. $_parent_role_type = $_agent_class->getRoleType($_parent_id);
  130. if (AgentConst::ROLE_TYPE_GROUP == $_parent_role_type) {
  131. /* 一级渠道的直接玩家的玩家 */
  132. $_aor_class->setParentId($_aor_class->getAgentId());
  133. $_rate_class->setAgRate($_aor_class->getAppId(), $_aor_class->getParentId());
  134. $_aor_class->setParentRebate($_rate_class->getAgentRebate());
  135. return $_ai_class->setLevelOne($_aor_class, $_deduct_fee);
  136. } else if (AgentConst::ROLE_TYPE_AGENT == $_parent_role_type) {
  137. /* 二级渠道的直接玩家的玩家 */
  138. $_rate_class->setAgRate($_aor_class->getAppId(), $_aor_class->getAgentId());
  139. $_aor_class->setAgentRebate($_rate_class->getAgentRebate());
  140. $_rate_class->setAgRate($_aor_class->getAppId(), $_aor_class->getParentId());
  141. $_pp_id = $_agent_class->getParentId($_parent_id);
  142. $_pp_role_type = $_agent_class->getRoleType($_pp_id);
  143. if (AgentConst::ROLE_TYPE_GROUP == $_pp_role_type) {
  144. $_aor_class->setParentId($_pp_id);
  145. $_rate_class->setAgRate($_aor_class->getAppId(), $_aor_class->getParentId());
  146. $_aor_class->setParentRebate($_rate_class->getAgentRebate());
  147. }
  148. return $_ai_class->setLevelTwo($_aor_class, $_deduct_fee);
  149. }
  150. }
  151. return SettleStatus::NO_ERROR;
  152. }
  153. /**
  154. * 从渠道平台币充值中计算收益
  155. *
  156. * @param string $order_id
  157. *
  158. * @return bool
  159. */
  160. public function incomeFromPac($order_id) {
  161. if (empty($order_id)) {
  162. $_code = OrderStatus::ORDER_NOT_EXISTS;
  163. return $_code;
  164. }
  165. $_pac_model = new PtbAgentChargeModel();
  166. $_order_data = $_pac_model->getDetail($order_id);
  167. if (empty($_order_data)) {
  168. $_code = OrderStatus::ORDER_NOT_EXISTS;
  169. return $_code;
  170. }
  171. if (OrderConst::PAY_STATUS_SUC != $_order_data['status']) {
  172. $_code = SettleStatus::ORDER_NOT_PAYED;
  173. Log::write(
  174. "func=".__FUNCTION__."&class=".__CLASS__."&code=".$_code.'&msg='.SettleStatus::getMsg($_code)."&order="
  175. .http_build_query($_order_data),
  176. LOG::ERROR
  177. );
  178. return $_code;
  179. }
  180. $_aor_class = new AoRequest();
  181. $_aor_class->setDataFromPacOrder($_order_data);
  182. $_agent_id = $_aor_class->getAgentId();
  183. $_agent_class = new Agent();
  184. $_role_type = $_agent_class->getRoleType($_agent_id);
  185. if (empty($_role_type)) {
  186. $_code = SettleStatus::INNER_ERROR;
  187. Log::write(
  188. "func=".__FUNCTION__."&class=".__CLASS__."&code=".$_code.'&role_type=error&msg='.SettleStatus::getMsg(
  189. $_code
  190. )."&order="
  191. .http_build_query($_order_data),
  192. LOG::ERROR
  193. );
  194. return $_code;
  195. }
  196. if (AgentConst::ROLE_TYPE_AGENT != $_role_type) {
  197. return CommonStatus::NO_ERROR;
  198. }
  199. $_parent_id = $_agent_class->getParentId($_agent_id);
  200. $_parent_role_type = $_agent_class->getRoleType($_parent_id);
  201. /* 渠道折扣 */
  202. $_rate_class = new PtbRate($_parent_id);
  203. $_ai_class = new AgentIncome();
  204. if (AgentConst::ROLE_TYPE_GROUP == $_parent_role_type) {
  205. /* 一级渠道 */
  206. $_aor_class->setFromId($_agent_id);
  207. $_aor_class->setParentId($_parent_id);
  208. $_aor_class->setParentRebate($_rate_class->getAgentRate());
  209. return $_ai_class->setLevelOne($_aor_class);
  210. }
  211. return SettleStatus::NO_ERROR;
  212. }
  213. /**
  214. * 从玩家平台币充值中计算收益
  215. *
  216. * @param string $order_id
  217. *
  218. * @return bool
  219. */
  220. public function incomeFromPmc($order_id) {
  221. if (empty($order_id)) {
  222. $_code = OrderStatus::ORDER_NOT_EXISTS;
  223. return $_code;
  224. }
  225. $_order_data = (new PtbChargeModel())->getDetail($order_id);
  226. if (empty($_order_data)) {
  227. $_code = OrderStatus::ORDER_NOT_EXISTS;
  228. return $_code;
  229. }
  230. if (OrderConst::PAY_STATUS_SUC != $_order_data['status']) {
  231. $_code = SettleStatus::ORDER_NOT_PAYED;
  232. Log::write(
  233. "func=".__FUNCTION__."&class=".__CLASS__."&code=".$_code.'&msg='.SettleStatus::getMsg($_code)."&order="
  234. .http_build_query($_order_data),
  235. LOG::ERROR
  236. );
  237. return $_code;
  238. }
  239. $_aor_class = new AoRequest();
  240. $_aor_class->setDataFromPcOrder($_order_data);
  241. $_agent_id = $_aor_class->getAgentId();
  242. $_agent_class = new Agent();
  243. $_role_type = $_agent_class->getRoleType($_agent_id);
  244. if (empty($_role_type)) {
  245. $_code = SettleStatus::INNER_ERROR;
  246. Log::write(
  247. "func=".__FUNCTION__."&class=".__CLASS__."&code=".$_code.'&role_type=error&msg='.SettleStatus::getMsg(
  248. $_code
  249. )."&order="
  250. .http_build_query($_order_data),
  251. LOG::ERROR
  252. );
  253. return $_code;
  254. }
  255. /* 玩家平台币充值 */
  256. $_rate_class = new PtbRate($_aor_class->getAgentId());
  257. $_ai_class = new AgentIncome();
  258. if (AgentConst::ROLE_TYPE_GROUP == $_role_type) {
  259. /* 一级渠道的直接玩家 */
  260. $_aor_class->setParentId($_aor_class->getAgentId());
  261. $_aor_class->setParentRate($_rate_class->getAgentRate());
  262. return $_ai_class->setLevelOne($_aor_class);
  263. } else if (AgentConst::ROLE_TYPE_AGENT == $_role_type) {
  264. /* 二级渠道的直接玩家 */
  265. $_aor_class->setAgentRate($_rate_class->getAgentRate());
  266. $_parent_id = $_agent_class->getParentId($_agent_id);
  267. $_parent_role_type = $_agent_class->getRoleType($_parent_id);
  268. if (AgentConst::ROLE_TYPE_GROUP == $_parent_role_type) {
  269. $_aor_class->setParentId($_parent_id);
  270. $_rate_class->setARate($_aor_class->getParentId());
  271. $_aor_class->setParentRate($_rate_class->getAgentRate());
  272. }
  273. return $_ai_class->setLevelTwo($_aor_class);
  274. } else if (AgentConst::ROLE_TYPE_MEMBER == $_role_type) {
  275. $_aor_class->setFlag($_aor_class::FLAG_MEM_MEM_SDK);
  276. // TODO: wuyonghong 2018/5/14 计算积分价值
  277. $_deduct_fee = 0;
  278. $_parent_id = $_agent_class->getParentId($_agent_id);
  279. if (empty($_parent_id)) {
  280. /* 官方渠道不需计算 */
  281. return SettleStatus::NO_ERROR;
  282. }
  283. $_aor_class->setAgentId($_parent_id);
  284. $_parent_role_type = $_agent_class->getRoleType($_parent_id);
  285. if (AgentConst::ROLE_TYPE_GROUP == $_parent_role_type) {
  286. /* 一级渠道的直接玩家的玩家 */
  287. $_aor_class->setParentId($_parent_id);
  288. $_rate_class->setARate($_parent_id);
  289. $_aor_class->setParentRate($_rate_class->getAgentRate());
  290. return $_ai_class->setLevelOne($_aor_class, $_deduct_fee);
  291. } else if (AgentConst::ROLE_TYPE_AGENT == $_parent_role_type) {
  292. /* 二级渠道的直接玩家的玩家 */
  293. $_aor_class->setAgentId($_parent_id);
  294. $_rate_class->setARate($_parent_id);
  295. $_aor_class->setAgentRate($_rate_class->getAgentRate());
  296. $_pp_id = $_agent_class->getParentId($_parent_id);
  297. $_pp_role_type = $_agent_class->getRoleType($_pp_id);
  298. if (AgentConst::ROLE_TYPE_GROUP == $_pp_role_type) {
  299. $_aor_class->setParentId($_pp_id);
  300. $_rate_class->setARate($_pp_id);
  301. $_aor_class->setAgentRate($_rate_class->getAgentRate());
  302. }
  303. return $_ai_class->setLevelTwo($_aor_class, $_deduct_fee);
  304. }
  305. }
  306. return SettleStatus::NO_ERROR;
  307. }
  308. /**
  309. * 从渠道代充游戏币中计算收益
  310. *
  311. * @param string $order_id
  312. *
  313. * @return bool
  314. */
  315. public function incomeFroGmc($order_id) {
  316. if (empty($order_id)) {
  317. $_code = OrderStatus::ORDER_NOT_EXISTS;
  318. return $_code;
  319. }
  320. $_order_data = (new GmChargeModel())->getDetail($order_id);
  321. if (empty($_order_data)) {
  322. $_code = OrderStatus::ORDER_NOT_EXISTS;
  323. return $_code;
  324. }
  325. if (OrderConst::PAY_STATUS_SUC != $_order_data['status']) {
  326. $_code = SettleStatus::ORDER_NOT_PAYED;
  327. Log::write(
  328. "func=".__FUNCTION__."&class=".__CLASS__."&code=".$_code.'&msg='.SettleStatus::getMsg($_code)."&order="
  329. .http_build_query($_order_data),
  330. LOG::ERROR
  331. );
  332. return $_code;
  333. }
  334. $_aor_class = new AoRequest();
  335. $_aor_class->setDataFromGmcOrder($_order_data);
  336. $_agent_id = $_aor_class->getAgentId();
  337. $_agent_class = new Agent();
  338. $_role_type = $_agent_class->getRoleType($_agent_id);
  339. if (empty($_role_type)) {
  340. $_code = SettleStatus::INNER_ERROR;
  341. Log::write(
  342. "func=".__FUNCTION__."&class=".__CLASS__."&code=".$_code.'&role_type=error&msg='.SettleStatus::getMsg(
  343. $_code
  344. )."&order="
  345. .http_build_query($_order_data),
  346. LOG::ERROR
  347. );
  348. return $_code;
  349. }
  350. /* 玩家平台币充值 */
  351. $_ai_class = new AgentIncome();
  352. if (AgentConst::ROLE_TYPE_AGENT == $_role_type) {
  353. /* 二级渠道代充 给上级计算收益*/
  354. $_agent_info = (new AgentCache())->getInfoByAgentId($_agent_id);
  355. /*有父渠道*/
  356. if (!empty($_agent_info['parent_id'])) {
  357. $_rate_class = new Rate($_aor_class->getAppId(), $_aor_class->getAgentId());
  358. $_prate_class = new Rate($_aor_class->getAppId(), $_agent_info['parent_id']);
  359. if ($_rate_class->getAgentRate() > $_prate_class->getAgentRate()) {
  360. $_income = $_aor_class->getAmount() * ($_rate_class->getAgentRate() - $_prate_class->getAgentRate(
  361. ));
  362. $_aor_class->setParentGain($_income);
  363. $_aor_class->setParentRate($_prate_class->getAgentRate());
  364. }
  365. $_aor_class->setParentId($_agent_info['parent_id']);
  366. }
  367. return $_ai_class->setParent($_aor_class);
  368. }
  369. return SettleStatus::NO_ERROR;
  370. }
  371. /**
  372. * 计算cpa收益
  373. *
  374. * @param $mem_id
  375. *
  376. * @return int
  377. */
  378. public function incomeFroCpa($mem_id) {
  379. if (empty($mem_id)) {
  380. return SettleStatus::NO_ERROR;
  381. }
  382. $_mem_data = MemCache::ins()->getInfoById($mem_id);
  383. if (empty($_mem_data['agent_id']) || empty($_mem_data['app_id']) || empty($_mem_data['reg_ip'])) {
  384. /* 非渠道游戏注册的不需要计算,没IP不计算 */
  385. return SettleStatus::NO_ERROR;
  386. }
  387. $_rate_class = new Rate($_mem_data['app_id'], $_mem_data['agent_id']);
  388. if (GameConst::RATE_AGENT_BENEFIT_REWARD != $_rate_class->getAgentBenefitType()) {
  389. /* 非CPA模式无需计算 */
  390. return SettleStatus::NO_ERROR;
  391. }
  392. $_acl_model = new AgentCpaLogModel();
  393. $_id = $_acl_model->getIdByMemId($mem_id);
  394. if (!empty($_id)) {
  395. /* 已存在玩家不需要重复计算 */
  396. return SettleStatus::NO_ERROR;
  397. }
  398. /* 获取当前玩家是否微信用户 */
  399. $_open_id = (new MemoauthModel())->getOpenidByMemId('', $mem_id);
  400. if (empty($_open_id)) {
  401. /* 非第三方注册用户需要ip 排重 */
  402. $_id = $_acl_model->getIdByIp($_mem_data['reg_ip']);
  403. if (!empty($_id)) {
  404. /* 已存在IP不需要重复计算 */
  405. Log::write(
  406. 'line='.__LINE__.'&func='.__FUNCTION__.'&class='.__CLASS__.'&mem_id='.$mem_id.'&ip='
  407. .$_mem_data['reg_ip'].'&error=当前IP已计算过CPA', Log::ERROR
  408. );
  409. return SettleStatus::NO_ERROR;
  410. }
  411. }
  412. $_aor_class = new AoRequest();
  413. $_order_id = StrUtils::genOrderId(
  414. $_mem_data['app_id'], $_mem_data['agent_id'], $mem_id, WalletConst::WALLET_ORDER_PREFIX_CPA
  415. );
  416. $_aor_class->setOrderId($_order_id);
  417. $_aor_class->setFlag(AoRequest::FLAG_AGENT_CPA);
  418. $_aor_class->setMemId($mem_id);
  419. $_aor_class->setAppId($_mem_data['app_id']);
  420. $_aor_class->setAgentId($_mem_data['agent_id']);
  421. $_agent_id = $_aor_class->getAgentId();
  422. $_agent_class = new Agent();
  423. $_role_type = $_agent_class->getRoleType($_agent_id);
  424. if (empty($_role_type)) {
  425. $_code = SettleStatus::INNER_ERROR;
  426. Log::write(
  427. 'line='.__LINE__.'&func='.__FUNCTION__.'&class='.__CLASS__.'&mem_id='.$mem_id.'&agent_id='
  428. .$_agent_id.'&error=渠道类型错误', Log::ERROR
  429. );
  430. return $_code;
  431. }
  432. if (AgentConst::ROLE_TYPE_GROUP == $_role_type) {
  433. /* 一级渠道的直接玩家 */
  434. $_aor_class->setAgentId(0);
  435. $_aor_class->setParentId($_aor_class->getAgentId());
  436. $_aor_class->setParentGain($_rate_class->getAgentReward());
  437. $_rs = (new AgentOrder())->createAoOrder($_aor_class);
  438. } else if (AgentConst::ROLE_TYPE_AGENT == $_role_type) {
  439. /* 二级渠道的直接玩家 */
  440. $_agent_gain = $_rate_class->getAgentReward();
  441. $_aor_class->setAgentGain($_agent_gain);
  442. $_parent_id = $_agent_class->getParentId($_agent_id);
  443. $_parent_role_type = $_agent_class->getRoleType($_parent_id);
  444. if (AgentConst::ROLE_TYPE_GROUP == $_parent_role_type) {
  445. $_aor_class->setParentId($_parent_id);
  446. $_parent_rate_class = new Rate($_mem_data['app_id'], $_parent_id);
  447. if (GameConst::RATE_AGENT_BENEFIT_REWARD == $_parent_rate_class->getAgentBenefitType()) {
  448. $_parent_gain = $_parent_rate_class->getAgentReward();
  449. $_parent_gain = $_parent_gain - $_agent_gain;
  450. $_parent_gain = $_parent_gain >= CommonConst::CONST_ZERO ? $_parent_gain : CommonConst::CONST_ZERO;
  451. $_aor_class->setParentGain($_parent_gain);
  452. }
  453. }
  454. $_rs = (new AgentOrder())->createAoOrder($_aor_class);
  455. } else {
  456. return SettleStatus::NO_ERROR;
  457. }
  458. if (SettleStatus::NO_ERROR != $_rs) {
  459. Log::write(
  460. 'line='.__LINE__.'&func='.__FUNCTION__.'&class='.__CLASS__.'&mem_id='.$mem_id.'&agent_id='
  461. .$_agent_id.'&error='.$_rs.'&aor_class='.json_encode($_aor_class), Log::ERROR
  462. );
  463. return $_rs;
  464. }
  465. /* 插入记录 */
  466. $_data = [
  467. 'order_id' => $_aor_class->getOrderId(),
  468. 'parent_id' => $_aor_class->getParentId(),
  469. 'agent_id' => $_aor_class->getAgentId(),
  470. 'app_id' => $_aor_class->getAppId(),
  471. 'mem_id' => $_aor_class->getMemId(),
  472. 'ip' => $_mem_data['reg_ip'],
  473. 'agent_cpa' => $_aor_class->getAgentGain(),
  474. 'parent_cpa' => $_aor_class->getParentGain()
  475. ];
  476. (new AgentCpaLogModel())->addData($_data);
  477. return SettleStatus::NO_ERROR;
  478. }
  479. }