RcCommissionLog.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <?php
  2. /*
  3. * @Author: chaimeihan 1852293413@qq.com
  4. * @Date: 2024-04-23 14:59:58
  5. * @LastEditors: chaimeihan 1852293413@qq.com
  6. * @LastEditTime: 2024-05-09 08:58:41
  7. * @FilePath: \PHP\models\RcCommissionLog.php
  8. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  9. */
  10. namespace app\models;
  11. use Yii;
  12. use yii\behaviors\TimestampBehavior;
  13. use app\modules\admin\models\wechat_mp\CardForm;
  14. use app\utils\IotCloudHelper;
  15. /**
  16. * This is the model class for table "{{%rc_commission_log}}".
  17. *
  18. * @property integer $id
  19. * @property integer $store_id
  20. * @property integer $order_type
  21. * @property integer $order_id
  22. * @property integer $user_id
  23. * @property integer $amount
  24. * @property string $desc
  25. * @property integer $before
  26. * @property integer $after
  27. * @property string $operator
  28. * @property integer $operator_id
  29. * @property integer $log_type
  30. * @property integer $type
  31. * @property integer $operator_type
  32. * @property string $pic_url
  33. * @property string $explain
  34. * @property integer $created_at
  35. * @property integer $from
  36. * @property integer $from_user_id
  37. * @property integer $profit
  38. * @property integer $saas_id
  39. */
  40. class RcCommissionLog extends \yii\db\ActiveRecord
  41. {
  42. /**
  43. * 收入类型
  44. */
  45. const LOG_TYPE_INCOME = 1;
  46. /**
  47. * 支出类型
  48. */
  49. const LOG_TYPE_EXPEND = 2;
  50. public static $type_budget = [
  51. self::LOG_TYPE_INCOME,
  52. self::LOG_TYPE_EXPEND
  53. ];
  54. /**
  55. * 充值订单
  56. */
  57. const TYPE_RECHARGE_ORDER = 0;
  58. /**
  59. * 商城订单
  60. */
  61. const TYPE_PLATFORM_ORDER = 1;
  62. /**
  63. * 秒杀订单
  64. */
  65. const TYPE_MS_ORDER = 2;
  66. /**
  67. * 拼团订单
  68. */
  69. const TYPE_PT_ORDER = 3;
  70. /**
  71. * 商城订单退款
  72. */
  73. const TYPE_PLATFORM_REFUND_ORDER = 4;
  74. /**
  75. * 充值订单退款(减余额)
  76. */
  77. const TYPE_RECHARGE_REFUND_ORDER = 41;
  78. /**
  79. * 商城秒杀退款
  80. */
  81. const TYPE_MS_REFUND_ORDER = 5;
  82. /**
  83. * 商城拼团退款
  84. */
  85. const TYPE_PT_REFUND_ORDER = 6;
  86. /**
  87. * 商城预约退款
  88. */
  89. const TYPE_YY_REFUND_ORDER = 7;
  90. /**
  91. * 预约订单
  92. */
  93. const TYPE_YY_ORDER = 8;
  94. /**
  95. * 预约订单
  96. */
  97. const TYPE_SCRATCH_ORDER = 9;
  98. /**
  99. * 大转盘
  100. */
  101. const TYPE_POND_ORDER = 10;
  102. /**
  103. * 供货商订单
  104. */
  105. const TYPE_SUPPLIER_ORDER = 11;
  106. /**
  107. * 会员购买订单
  108. */
  109. const TYPE_LEVEL_ORDER = 12;
  110. /**
  111. * 当面付
  112. */
  113. const TYPE_SCAN_CODE_PAY = 13;
  114. /**
  115. * saas积分商品订单
  116. */
  117. const TYPE_SAAS_INTEGRAL_ORDER = 14;
  118. /**
  119. * saas积分商品订单
  120. */
  121. const TYPE_BALANCE_TO_COMMISSION = 15;
  122. /**
  123. * 签到送积分
  124. */
  125. const TYPE_REGISTER_INTEGRAL = 16;
  126. /**
  127. * 问答专区提问
  128. */
  129. const TYPE_QUESTION_INTEGRAL = 17;
  130. /**
  131. * 问答专区看视频广告
  132. */
  133. const TYPE_QUESTION_AD = 18;
  134. /**
  135. * 充值一级上级返现奖励
  136. */
  137. const TYPE_LEVEL_ONE_BONUS = 20;
  138. /**
  139. * 充值推广佣金
  140. */
  141. const TYPE_REFERRAL_COMMISSION = 21;
  142. /**
  143. * 充值一级上级返现奖励
  144. */
  145. const TYPE_LEVEL_TWO_BONUS = 22;
  146. /**
  147. * 余额
  148. */
  149. const TYPE_BALANCE = 2;
  150. /**
  151. * 积分
  152. */
  153. const TYPE_INTEGRAL = 1;
  154. /**
  155. * 商品余额抵扣
  156. */
  157. const TYPE_GOODS_BALANCE = 19;
  158. /**
  159. * 微信
  160. */
  161. const TYPE_WECHAT = 3;
  162. /**
  163. * 支付宝
  164. */
  165. const TYPE_ALIPAY = 4;
  166. public static $valid_type = [
  167. self::TYPE_BALANCE,
  168. self::TYPE_INTEGRAL,
  169. self::TYPE_WECHAT,
  170. self::TYPE_ALIPAY
  171. ];
  172. /**
  173. * 后台改动
  174. */
  175. const TYPE_OPERATOR_BACK = 2;
  176. /**
  177. * 前台变化
  178. */
  179. const TYPE_OPERATOR_NORMAL = 1;
  180. public static $type_order = [
  181. self::TYPE_RECHARGE_ORDER,
  182. self::TYPE_PLATFORM_ORDER,
  183. self::TYPE_MS_ORDER,
  184. self::TYPE_PT_ORDER,
  185. self::TYPE_PLATFORM_REFUND_ORDER,
  186. self::TYPE_MS_REFUND_ORDER,
  187. self::TYPE_PT_REFUND_ORDER
  188. ];
  189. /**
  190. * @inheritdoc
  191. */
  192. public static function tableName()
  193. {
  194. return '{{%rc_commission_log}}';
  195. }
  196. /**
  197. * @inheritdoc
  198. */
  199. public function rules()
  200. {
  201. return [
  202. [[
  203. 'user_id', 'type', 'amount', 'desc', 'order_type',
  204. 'log_type', 'type', 'parent_id', 'recharge_id', 'commission_type'
  205. ], 'required'],
  206. [[
  207. 'user_id', 'type', 'created_at', 'order_type', 'order_id', 'log_type',
  208. ], 'integer'],
  209. [['amount',], 'number'],
  210. [['desc',], 'string'],
  211. ];
  212. }
  213. /**
  214. * @inheritdoc
  215. */
  216. public function attributeLabels()
  217. {
  218. return [];
  219. }
  220. }