<?php
/**
* 成就系统
*/
class Achievement
{
	/**
	 * 成就列表
	 */
	public function get($param) {
		$data = array('code' => -1, 'list' => []);
		$uid = (int)$param['uid'];
		if (!$uid) {
			return json_encode($data);
		}
		$data = oo::commonOprModel('achievement')->getList($uid);
		return json_encode($data);
	}

	/**
	 * 成就领奖
	 */
	public function reward($param) {
		$uid = (int)$param['uid'];
		$id = (int)$param['id']; // 任务ID
		$subid = (int)$param['subtask']; // 子任务ID
		if (!$uid || !$id || !$subid) {
			return json_encode(array('code' => -1, 'money' => 0));
		}
		$data = oo::commonOprModel('achievement')->reward($uid, $id, $subid);
		return json_encode($data);
	}
}