payAmount <= 0) { # 免费用户 return 0; } else if ($this->payAmount < 100) { # 100以下,小R return 1; } else if ($this->payAmount < 1000) { # 1000以下,中产 return 2; } else { # 大于1k的都算大R了 return 3; } } } /** * 用户画像 * @version * 1.0.0 Created at 2017-9-23. by --gwang * @author gwang (mail@wanggangzero.cn) * @copyright ? 2017-9-23, SJZ LoyalSoft Corporation & gwang. All rights reserved. */ class Data_UserProfile extends Object_ext { //put your code here /** * 付费画像 * @var Data_UserPaymentProfile */ public $payment; public function OnPay($args = null) { // 提取参数 extract or 直接按照名字提取 // 更新付费总额, 次数, 最后一次付费 if (null === $args || !is_array($args)) { return false; } $amt = $args['amt']; if ($amt) { # 参数不为空 $this->payment->lastPayTs = now(); $this->payment->payAmount += $amt; $this->payment->payTimes++; return true; } return false; } public function __construct($arg = null) { parent::__construct($arg); $this->payment = new Data_UserPaymentProfile($this->payment); } }